That's a great idea, actually. Thank you
On Wednesday, June 1, 2022 at 4:56:31 PM UTC+3 Adam Johnson wrote:
> Modifying the connections object seems like the wrong way to approach
> this, as it's not intended for mutation. Did you consider writing a
> database router and then having a context m
Modifying the connections object seems like the wrong way to approach this,
as it's not intended for mutation. Did you consider writing a database
router and then having a context manager that affects the router's state?
https://docs.djangoproject.com/en/4.0/topics/db/multi-db/#topics-db-multi-db-r
In some of the previous version on Django I had a very useful context
manager.
from contextlib import ContextDecorator
from django.db import connections
class overwrite_default_connection(ContextDecorator):
prev_default = None
write_connection = None
def __init__(self, write_con