Opened 2 years ago

Closed 2 years ago

#33592 closed Bug (fixed)

view_on_site redirect does not work for custom admin site.

Reported by: Stefan Wehrmeyer Owned by: Stefan Wehrmeyer
Component: contrib.admin Version: 4.0
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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.

Change History (5)

comment:1 by Mariusz Felisiak, 2 years ago

Has patch: set
Needs tests: set
Owner: changed from nobody to Stefan Wehrmeyer
Status: newassigned
Triage Stage: UnreviewedAccepted

Thanks

comment:2 by Mariusz Felisiak, 2 years ago

Summary: `view_on_site` redirect does not work for custom admin siteview_on_site redirect does not work for custom admin site.

comment:3 by Stefan Wehrmeyer, 2 years ago

Needs tests: unset

comment:4 by Mariusz Felisiak, 2 years ago

Triage Stage: AcceptedReady for checkin

comment:5 by Mariusz Felisiak <felisiak.mariusz@…>, 2 years ago

Resolution: fixed
Status: assignedclosed

In 561761c6:

Fixed #33592 -- Fixed "View on Site" links in custom admin site.

Note: See TracTickets for help on using tickets.
Back to Top