Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#9908 closed (fixed)

Allow individual app_index templates for different apps

Reported by: arne Owned by: Jannis Leidel
Component: contrib.admin Version: master
Severity: Keywords: app_index
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

django.contrib.admin allows customization of individual change_list or change_form templates by using a list of templates in the form of (example from render_change_form method):

self.change_form_template or [
    "admin/%s/%s/change_form.html" % (app_label, opts.object_name.lower()),
    "admin/%s/change_form.html" % app_label,
    "admin/change_form.html"
]

This mechanism does not work for the app_index template but could easily be implmented. I've attached a diff, which allows placing templates at 'admin/<app_label>/app_index.html' for individual apps, while still allowing global customization by setting the app_index_template class attribute and still falling back to 'admin/app_index.html'

Attachments (3)

app_index_template.diff (642 bytes) - added by arne 8 years ago.
app_index_docs.diff (452 bytes) - added by arne 8 years ago.
app_index_r9814.diff (1.1 KB) - added by arne 8 years ago.
Merged both patches and updated to r9814

Download all attachments as: .zip

Change History (10)

Changed 8 years ago by arne

Attachment: app_index_template.diff added

comment:1 Changed 8 years ago by Jannis Leidel

Needs documentation: set
Owner: changed from nobody to Jannis Leidel
Status: newassigned

Changed 8 years ago by arne

Attachment: app_index_docs.diff added

Changed 8 years ago by arne

Attachment: app_index_r9814.diff added

Merged both patches and updated to r9814

comment:2 Changed 8 years ago by Jannis Leidel

Needs documentation: unset
Needs tests: set
Triage Stage: UnreviewedAccepted

comment:3 Changed 8 years ago by Alex Gaynor

milestone: 1.1
Needs tests: unset
Triage Stage: AcceptedReady for checkin

comment:4 Changed 8 years ago by Jacob

Triage Stage: Ready for checkinAccepted

Needs a test of the new template.

comment:5 Changed 8 years ago by Jacob

Triage Stage: AcceptedReady for checkin

OK, never mind.

comment:6 Changed 8 years ago by Jacob

Resolution: fixed
Status: assignedclosed

(In [10317]) Fixed #9908: allow individual app index templates in the admin. Thanks, arne.

comment:7 Changed 5 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

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