[Django] #21371: Admin templates use a `bodyclass` block without ever calling super.

4 views
Skip to first unread message

Django

unread,
Nov 2, 2013, 9:11:28 AM11/2/13
to django-...@googlegroups.com
#21371: Admin templates use a `bodyclass` block without ever calling super.
-----------------------------------------+--------------------
Reporter: Keryn Knight <django@…> | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------------------+--------------------
A reasonable expectation is, I think, to be able to subsume the
`admin/base_site.html` template to do a few tweaks for display purposes,
by throwing it in an earlier INSTALLED_APP or into one of the paths set in
TEMPLATE_DIRS; for the most part, this works as expected.

However, trying to do something like:
{{{
{% extends "admin/base.html" %}
{% block bodyclass %}mymagicalbase {{ block.super }}{% endblock %}
}}}
does not work as desired, because subsequent templates [those which
inherit from base_site] define the `bodyclass` block without calling super
themselves; see
[https://github.com/django/django/search?q=bodyclass++path%3Adjango%2Fcontrib%2Fadmin%2Ftemplates&type=Code
GitHub search] demonstrating the files affected; with the notable
exception of app_index, which ''does'' call super.

By contrast, all of the templates which require `extrastyles` ''do'' call
super to ensure the template hierarchy's block representation is preserved
as the template author designed.

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

Django

unread,
Nov 2, 2013, 9:49:10 AM11/2/13
to django-...@googlegroups.com
#21371: Admin templates use a `bodyclass` block without ever calling super.
-------------------------------------+-------------------------------------
Reporter: Keryn Knight | Owner: nobody
<django@…> | Status: new
Type: | Version: master
Cleanup/optimization | Resolution:
Component: contrib.admin | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by claudep):

* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted


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

Django

unread,
Nov 6, 2013, 9:29:55 PM11/6/13
to django-...@googlegroups.com
#21371: Admin templates use a `bodyclass` block without ever calling super.
-------------------------------------+-------------------------------------
Reporter: Keryn Knight | Owner: resry
<django@…> | Status: assigned

Type: | Version: master
Cleanup/optimization | Resolution:
Component: contrib.admin | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by resry):

* owner: nobody => resry
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/21371#comment:2>

Django

unread,
Nov 7, 2013, 12:49:15 AM11/7/13
to django-...@googlegroups.com
#21371: Admin templates use a `bodyclass` block without ever calling super.
-------------------------------------+-------------------------------------
Reporter: Keryn Knight | Owner: resry
<django@…> | Status: assigned
Type: | Version: master
Cleanup/optimization | Resolution:
Component: contrib.admin | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------

Comment (by resry):

I've submitted a pull request from my branch at
[https://github.com/resry/django/tree/ticket_21371 ticket_21371].

--
Ticket URL: <https://code.djangoproject.com/ticket/21371#comment:3>

Django

unread,
Nov 9, 2013, 7:10:00 AM11/9/13
to django-...@googlegroups.com
#21371: Admin templates use a `bodyclass` block without ever calling super.
-------------------------------------+-------------------------------------
Reporter: Keryn Knight | Owner: resry
<django@…> | Status: assigned
Type: | Version: master
Cleanup/optimization | Resolution:
Component: contrib.admin | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------

Comment (by Keryn Knight <django@…>):

For completeness' sake, it looks like there was previously an attempt to
fix a small subset of the affected templates, in #7425

--
Ticket URL: <https://code.djangoproject.com/ticket/21371#comment:4>

Django

unread,
Nov 9, 2013, 10:04:52 AM11/9/13
to django-...@googlegroups.com
#21371: Admin templates use a `bodyclass` block without ever calling super.
-------------------------------------+-------------------------------------
Reporter: Keryn Knight | Owner: resry
<django@…> | Status: assigned
Type: | Version: master
Cleanup/optimization | Resolution:
Component: contrib.admin | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: | Patch needs improvement: 0
Has patch: 1 | UI/UX: 0
Needs tests: 1 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by claudep):

* has_patch: 0 => 1
* needs_tests: 0 => 1


Comment:

Thanks Keryn, #7425 has been set as a duplicate.

--
Ticket URL: <https://code.djangoproject.com/ticket/21371#comment:5>

Django

unread,
Jan 9, 2014, 5:07:28 AM1/9/14
to django-...@googlegroups.com
#21371: Admin templates use a `bodyclass` block without ever calling super.
-------------------------------------+-------------------------------------
Reporter: Keryn Knight | Owner: resry
<django@…> | Status: assigned
Type: | Version: master
Cleanup/optimization | Resolution:
Component: contrib.admin | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: | Patch needs improvement: 0
Has patch: 1 | UI/UX: 0
Needs tests: 1 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------

Comment (by pouete):

Hello !
I have a [[https://github.com/django/django/pull/2152|pull request]] to
address this ticket !

Fix+test cases

--
Ticket URL: <https://code.djangoproject.com/ticket/21371#comment:6>

Django

unread,
Feb 5, 2014, 6:23:11 PM2/5/14
to django-...@googlegroups.com
#21371: Admin templates use a `bodyclass` block without ever calling super.
-------------------------------------+-------------------------------------
Reporter: Keryn Knight | Owner: resry
<django@…> | Status: assigned
Type: | Version: master
Cleanup/optimization | Resolution:
Component: contrib.admin | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: | Patch needs improvement: 1

Has patch: 1 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by timo):

* needs_better_patch: 0 => 1
* needs_tests: 1 => 0


Comment:

I've reviewed the pull request and left comments for improvement. Please
uncheck "Patch needs improvement" when it's updated.

--
Ticket URL: <https://code.djangoproject.com/ticket/21371#comment:7>

Django

unread,
Feb 10, 2014, 9:18:24 AM2/10/14
to django-...@googlegroups.com
#21371: Admin templates use a `bodyclass` block without ever calling super.
-------------------------------------+-------------------------------------
Reporter: Keryn Knight | Owner: resry
<django@…> | Status: closed
Type: | Version: master
Cleanup/optimization | Resolution: fixed

Component: contrib.admin | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: | Patch needs improvement: 1
Has patch: 1 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"f5123c7291e855713b59e739bad0e50a1d50d3ef"]:
{{{
#!CommitTicketReference repository=""
revision="f5123c7291e855713b59e739bad0e50a1d50d3ef"
Fixed #21371 -- Added the block.super to admin bodyclass blocks.

Thanks Keryn Knight for the report.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21371#comment:8>

Reply all
Reply to author
Forward
0 new messages