Changes between Version 1 and Version 2 of Ticket #34165


Ignore:
Timestamp:
Nov 16, 2022, 4:36:47 AM (2 years ago)
Author:
Vasanth
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #34165 – Description

    v1 v2  
    77**''Minimal example''**
    88
    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.
     9Setup 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
     11Ideally none of this code must be called as the DB was specified during management command.
    1012
    1113
     
    4850
    4951    def db_for_read(self, model, **hints):
     52        print("read", hints)
    5053        return self._default_db()
    5154
    5255    def db_for_write(self, model, **hints):
     56        print("write", hints)
    5357        return self._default_db()
    5458
    5559    def allow_relation(self, obj1, obj2, **hints):
    56         return True
     60        return None
    5761
    5862    def allow_migrate(self, db, app_label, model_name=None, **hints):
    59         return True
     63        return None
    6064
    6165## settings.py
Back to Top