Opened 8 years ago

Closed 7 years ago

#27313 closed Cleanup/optimization (fixed)

Allow overriding the admin's popup response template on an app or model basis

Reported by: Ustun Ozgur Owned by: Michael Scott
Component: contrib.admin Version: 1.10
Severity: Normal Keywords: admin popup templates
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

In admin, popup response template ( admin/popup_response.html ) is project global, unlike change_form or change_list which can be overridden on an app or model basis.

Compare:

https://github.com/django/django/blob/12b9aa279f453f0a41c1153393b6211d8352302c/django/contrib/admin/options.py#L1105

to

https://github.com/django/django/blob/master/django/contrib/admin/options.py#L1064-L1067

Seems like an easy change and I would like to submit a patch in case there is a particular reason (security?) this is not customizable.

popup_response.html was originally added by this ticket: https://code.djangoproject.com/ticket/19773

Change History (6)

comment:1 by Tim Graham, 8 years ago

Type: BugCleanup/optimization

Probably the use case was never considered. Could you give one?

comment:2 by Ustun Ozgur, 8 years ago

In my particular case, I'm using django-selectable library. It provides autocomplete, but lacks it for M2M fields. So, I need some custom JS which basically needs some more data for a particular model so that I can inject it into the opener page.

comment:3 by Tim Graham, 8 years ago

Summary: Admin: Popup Response Template Needs to Be Overridable on an App or Model BasisAllow overriding the admin's popup response template on an app or model basis
Triage Stage: UnreviewedAccepted

comment:4 by Michael Scott, 8 years ago

Owner: changed from nobody to Michael Scott
Status: newassigned

I'll pick this up and see if I can make the suggested change.

comment:5 by Michael Scott, 7 years ago

Has patch: set

Sorry its taken a while but I've finally created a PR to make the proposed changes. Please let me know if there are any issues with the changes or potential improvements.

https://github.com/django/django/pull/7548

comment:6 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: assignedclosed

In 1e629928:

Fixed #27313 -- Allowed overriding admin popup response template.

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