[Django] #33592: `view_on_site` redirect does not work for custom admin site

16 views
Skip to first unread message

Django

unread,
Mar 21, 2022, 3:42:35 AM3/21/22
to django-...@googlegroups.com
#33592: `view_on_site` redirect does not work for custom admin site
--------------------------------------------+------------------------
Reporter: Stefan Wehrmeyer | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 4.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
--------------------------------------------+------------------------
All `reverse` calls in `contrib/admin/options.py` have a `current_app`
keyword argument, so they resolve with the current (possibly custom) admin
site – except the `reverse` call in `get_view_on_site_url`. This lead to
custom admin sites using the default admin to redirect via `view_on_site.

This is clearly a bug. When the default admin is handled with extra
protections outside of Django (e.g. additional basic auth), users of the
custom admin cannot use the "view on site" link because it routes through
the default admin.

Patch is easy and already here:
https://github.com/django/django/pull/15526

I'll try to provide a regression test as well.

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

Django

unread,
Mar 21, 2022, 3:46:04 AM3/21/22
to django-...@googlegroups.com
#33592: `view_on_site` redirect does not work for custom admin site
-------------------------------------+-------------------------------------
Reporter: Stefan Wehrmeyer | Owner: Stefan
| Wehrmeyer
Type: Bug | Status: assigned
Component: contrib.admin | Version: 4.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* owner: nobody => Stefan Wehrmeyer
* status: new => assigned
* has_patch: 0 => 1
* needs_tests: 0 => 1
* stage: Unreviewed => Accepted


Comment:

Thanks

--
Ticket URL: <https://code.djangoproject.com/ticket/33592#comment:1>

Reply all
Reply to author
Forward
0 new messages