Changes between Version 1 and Version 2 of Ticket #34165
- Timestamp:
- Nov 16, 2022, 4:36:47 AM (2 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #34165 – Description
v1 v2 7 7 **''Minimal example''** 8 8 9 Setup the custom middleware and custom DB Router as show below. Then run any DB migration. Ideally none of this code must be called as the DB was specified during management command. 9 Setup the custom middleware and custom DB Router as show below. Then run any DB migration. We see that "read {}" is being printed before the exception message. 10 11 Ideally none of this code must be called as the DB was specified during management command. 10 12 11 13 … … 48 50 49 51 def db_for_read(self, model, **hints): 52 print("read", hints) 50 53 return self._default_db() 51 54 52 55 def db_for_write(self, model, **hints): 56 print("write", hints) 53 57 return self._default_db() 54 58 55 59 def allow_relation(self, obj1, obj2, **hints): 56 return True60 return None 57 61 58 62 def allow_migrate(self, db, app_label, model_name=None, **hints): 59 return True63 return None 60 64 61 65 ## settings.py