Opened 7 years ago

Last modified 7 weeks ago

#11974 assigned New feature

Submit_row in admin doesn't follow the pattern of using admin/app_label/model/submit_line.html

Reported by: vbmendes Owned by: Raffaele Salmaso
Component: contrib.admin Version:
Severity: Normal Keywords: django admin templates
Cc: vbmendes, jedie, Andy Baker, andy@…, jgbreezer@…, raffaele.salmaso+djangoproject@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The admin's submit_row template tag does not follow the pattern for searching for templates: admin/app_label/model/submit_line.html

And it would be nice if it supports since it will be easier to override this template.

I made a patch that add this support.

Attachments (1)

admin_modify.diff (2.7 KB) - added by vbmendes 7 years ago.
Patch for the submit_rows template tag. With this, it will follow the template naming pattern of the admin.

Download all attachments as: .zip

Change History (14)

Changed 7 years ago by vbmendes

Attachment: admin_modify.diff added

Patch for the submit_rows template tag. With this, it will follow the template naming pattern of the admin.

comment:1 Changed 7 years ago by vbmendes

Cc: vbmendes added; vbmendes@… removed

comment:2 Changed 7 years ago by Jannis Leidel

Triage Stage: UnreviewedDesign decision needed

comment:3 Changed 6 years ago by jedie

Cc: jedie added

comment:4 Changed 6 years ago by Jannis Leidel

Needs documentation: set
Needs tests: set
Triage Stage: Design decision neededAccepted

comment:5 Changed 6 years ago by Ramiro Morales

See also #13875.

comment:6 Changed 6 years ago by Andy Baker

Cc: Andy Baker added
Severity: Normal
Type: Uncategorized

comment:7 Changed 6 years ago by Jannis Leidel

Easy pickings: unset
Type: UncategorizedNew feature
Version: 1.1

comment:8 Changed 6 years ago by Andy Baker <andy@…>

Cc: andy@… added
Needs documentation: unset
Needs tests: unset
UI/UX: unset

I am fairly sure it doesn't need tests or docs on the grounds that:

  1. We haven't documented the template structure of many similar parts of the admin
  2. We don't have specific tests for the template structure of other parts of the admin.

comment:9 Changed 6 years ago by Jannis Leidel

Needs documentation: set
Needs tests: set
Patch needs improvement: set

In fact there are several tests for using custom templates (e.g. source:django/trunk/tests/regressiontests/admin_views/tests.py?rev=16498#L608), so this definitely needs to be tested and documented as part of the "Overriding admin templates" docs (https://docs.djangoproject.com/en/dev//ref/contrib/admin/#overriding-admin-templates).

comment:10 Changed 5 years ago by John G

Cc: jgbreezer@… added

comment:11 Changed 8 weeks ago by Raffaele Salmaso

Cc: raffaele.salmaso+djangoproject@… added
Needs tests: unset

Added a PR => https://github.com/django/django/pull/7782

Hi, I've usually customize the submit row of many models in my admin.
At first I've used a similar strategy from the former patch (using render_to_string), but while working with my setup (only one admin.site), half of admin_views tests were broken. So this is why I used the InclusionNode for SubmitRowNode parent class.
Additionally I've added a { block submit-row %}{% endblock %} in default submit_line.html.

comment:12 Changed 8 weeks ago by Tim Graham

Needs documentation: unset
Patch needs improvement: unset

Don't forget to uncheck the "needs improvement" flags on the ticket, else it won't appear in the review queue.

comment:13 Changed 7 weeks ago by Raffaele Salmaso

Owner: changed from nobody to Raffaele Salmaso
Status: newassigned
Note: See TracTickets for help on using tickets.
Back to Top