#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
--------------------------------------+------------------------------------
Comment (by Rodrigo):
JIC, have you defined the models' admins as stated in
https://docs.djangoproject.com/en/2.2/topics/db/multi-db/#exposing-
multiple-databases-in-django-s-admin-interface ?
Replying to [comment:2 Simon Charette]:
> 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
`self._state.db` seems good to me as it stores in which database the
object is located
> I assume your `ContentType` read database is different from your
`SomeModel` read one?
It also seems to me that here is where the problem is, because the admin
does not support mult-db out of the box.
JIC, @zooqoo, have you defined the models' admins as stated in
https://docs.djangoproject.com/en/2.2/topics/db/multi-db/#exposing-
multiple-databases-in-django-s-admin-interface ?
--
Ticket URL: <https://code.djangoproject.com/ticket/30760#comment:3>
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.103ae71e8d2d3af6ae28e274475e6c6c%40djangoproject.com.