[Django] #32385: contrib.admin's base template loads i18n twice

23 views
Skip to first unread message

Django

unread,
Jan 26, 2021, 9:19:49 AM1/26/21
to django-...@googlegroups.com
#32385: contrib.admin's base template loads i18n twice
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
jneuendorf |
Type: | Status: new
Cleanup/optimization |
Component: | Version: 3.0
contrib.admin |
Severity: Normal | Keywords: admin, template
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Why is `i18n` loaded twice in the admin base template
https://github.com/django/django/blame/master/django/contrib/admin/templates/admin/base.html#L21
?

Following the links to the MRs in the blame view, there seems to be new no
apparent reason, for the template tag to be loaded twice, so I assume this
didn't happen on purpose and the 2nd occurrence should be removed.

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

Django

unread,
Jan 26, 2021, 9:25:47 AM1/26/21
to django-...@googlegroups.com
#32385: contrib.admin's base template loads i18n twice
-------------------------------------+-------------------------------------
Reporter: Jim | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: contrib.admin | Version: 3.1
Severity: Normal | Resolution:

Keywords: admin, template | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jim):

* version: 3.0 => 3.1


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

Django

unread,
Jan 26, 2021, 11:37:14 AM1/26/21
to django-...@googlegroups.com
#32385: contrib.admin's base template loads i18n twice
--------------------------------------+------------------------------------
Reporter: Jim | Owner: nobody
Type: Cleanup/optimization | Status: new

Component: contrib.admin | Version: 3.1
Severity: Normal | Resolution:
Keywords: admin, template | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Claude Paroz):

* easy: 0 => 1
* stage: Unreviewed => Accepted


Comment:

Good catch!

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

Django

unread,
Jan 26, 2021, 4:36:24 PM1/26/21
to django-...@googlegroups.com
#32385: contrib.admin's base template loads i18n twice
--------------------------------------+------------------------------------
Reporter: Jim | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admin | Version: 3.1
Severity: Normal | Resolution:
Keywords: admin, template | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Jim):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/13937 PR]

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

Django

unread,
Jan 26, 2021, 4:40:53 PM1/26/21
to django-...@googlegroups.com
#32385: contrib.admin's base template loads i18n twice
-------------------------------------+-------------------------------------
Reporter: Jim | Owner: Tim
Type: | McCurrach
Cleanup/optimization | Status: assigned

Component: contrib.admin | Version: 3.1
Severity: Normal | Resolution:
Keywords: admin, template | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim McCurrach):

* owner: nobody => Tim McCurrach
* status: new => assigned


Comment:

I have created a PR for this. I had a look through the other templates in
contrib, to check for any similar instances of this. I didn't find any
duplicates but I did notice:

- `...admin/prepopulated_fields_js.html` loads `l10n` but doesn't appear
to use any l10n template tags
- `...admin/change_list_results.html` and
`...admin/edit_inline/stacked.html` loads `static` but doesn't appear to
use any static template tags

Is it okay to remove those as well, and turn this into a general template
tags clear-up ticket. Or should they go into their own ticket?

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

Django

unread,
Jan 27, 2021, 1:57:27 AM1/27/21
to django-...@googlegroups.com
#32385: contrib.admin's base template loads i18n twice
-------------------------------------+-------------------------------------
Reporter: Jim | Owner: Tim
Type: | McCurrach
Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: 3.1
Severity: Normal | Resolution:
Keywords: admin, template | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak):

Replying to [comment:4 Tim McCurrach]:


> I have created a PR for this. I had a look through the other templates
in contrib, to check for any similar instances of this. I didn't find any
duplicates but I did notice:
>
> - `...admin/prepopulated_fields_js.html` loads `l10n` but doesn't
appear to use any l10n template tags
> - `...admin/change_list_results.html` and
`...admin/edit_inline/stacked.html` loads `static` but doesn't appear to
use any static template tags
>
> Is it okay to remove those as well, and turn this into a general
template tags clear-up ticket. Or should they go into their own ticket?

Thanks for checking this, we can remove them in the same PR:

- `l10n` is unused in `prepopulated_fields_js.html` since
d638cdc42acec608c1967f44af6be32a477c239f,
- `static` is unused in `change_list_results.html` since
f2ed107b079b050950e2fc5f2b689ca553ae12f5,
- `static` is unused in `stacked.html` since
d61ebc8fed212366340b1ed6f5d7722613801459.

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

Django

unread,
Jan 27, 2021, 6:16:40 AM1/27/21
to django-...@googlegroups.com
#32385: contrib.admin's base template loads i18n twice
-------------------------------------+-------------------------------------
Reporter: Jim | Owner: Tim
Type: | McCurrach
Cleanup/optimization | Status: closed
Component: contrib.admin | Version: 3.1
Severity: Normal | Resolution: fixed
Keywords: admin, template | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

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


Comment:

In [changeset:"a736baab92acb26eab09979143b2eafb53b957dd" a736baab]:
{{{
#!CommitTicketReference repository=""
revision="a736baab92acb26eab09979143b2eafb53b957dd"
Fixed #32385 -- Removed unused and duplicated loading of tags in admin
templates.

- `i18n` is duplicated in base.html.


- `l10n` is unused in prepopulated_fields_js.html

since d638cdc42acec608c1967f44af6be32a477c239f.


- `static` is unused in change_list_results.html

since f2ed107b079b050950e2fc5f2b689ca553ae12f5.


- `static` is unused in stacked.html
since d61ebc8fed212366340b1ed6f5d7722613801459.
}}}

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

Reply all
Reply to author
Forward
0 new messages