#30760: Django admin "view on site" button doesn't respect database routers
--------------------------------------+------------------------------------
     Reporter:  zooqooo               |                    Owner:  nobody
         Type:  Bug                   |                   Status:  new
    Component:  contrib.contenttypes  |                  Version:  2.2
     Severity:  Normal                |               Resolution:
     Keywords:  Admin, Routers        |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------
Changes (by Simon Charette):

 * component:  contrib.admin => contrib.contenttypes
 * stage:  Unreviewed => Accepted


Comment:

 The issue seems to be in `ContentType.get_object_for_this_type` which
 forces the use of `self._state.db`.

 
https://github.com/django/django/blob/72ebe85a269aab4bdb3829de4846b41f90973c5d/django/contrib/contenttypes/models.py#L175

 I assume your `ContentType` read database is different from your
 `SomeModel` read one?

 The `using` call has been around since multi-db support was added in
 
https://github.com/django/django/commit/ff60c5f9de3e8690d1e86f3e9e3f7248a15397c8
 #diff-90160d336c65903293180fa2d4a55664R102 10 years ago.

 Not sure how to solve this one because routing and contenttypes issues are
 tricky but tentatively accepting.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30760#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.7b4f26592dcb1d841a1fd95e4d88aff4%40djangoproject.com.

Reply via email to