[Django] #28526: Remedy verbose, often unhelpful undefined tempate variable logging

37 views
Skip to first unread message

Django

unread,
Aug 24, 2017, 11:10:14 AM8/24/17
to django-...@googlegroups.com
#28526: Remedy verbose, often unhelpful undefined tempate variable logging
------------------------------------------------+------------------------
Reporter: Tim Graham | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Template system | Version: master
Severity: Normal | Keywords:
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
As [https://groups.google.com/d/topic/django-
developers/zdULZcmAWNw/discussion discussed on django-developers], ticket
#18773 added logging of undefined template variables in Django 1.9
[dc5b01ad05e50ccde688c73c2ed3334a956076b0], however, I've seen several
reports of users finding this logging more confusing than helpful. For
example, [https://groups.google.com/forum/#!topic/django-
users/6Ve9dcv23sI/discussion admin templates log errors about missing
is_popup variables] which is how the template are designed (is_popup is
only in the contexts of pop ups) and the `TECHNICAL_404_TEMPLATE` (now
`django/views/templates/technical_404.html`) also logs errors (#26886)
without any obvious solution about how to prevent that. Also #28516 shows
the many warnings logged for an admin changelist page.

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

Django

unread,
Jan 22, 2021, 8:04:24 AM1/22/21
to django-...@googlegroups.com
#28526: Remedy verbose, often unhelpful undefined tempate variable logging
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Tim
Type: | McCurrach
Cleanup/optimization | Status: assigned

Component: Template system | Version: master
Severity: Normal | Resolution:

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim McCurrach):

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


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

Django

unread,
Jun 1, 2023, 7:20:49 AM6/1/23
to django-...@googlegroups.com
#28526: Remedy verbose, often unhelpful undefined tempate variable logging
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Tim
Type: | McCurrach
Cleanup/optimization | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Resolution:

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim McCurrach):

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

Django

unread,
Jun 2, 2023, 10:52:09 AM6/2/23
to django-...@googlegroups.com
#28526: Remedy verbose, often unhelpful undefined tempate variable logging
--------------------------------------+------------------------------------
Reporter: Tim Graham | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Template system | Version: dev
Severity: Normal | Resolution:

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim McCurrach):

* owner: Tim McCurrach => (none)
* status: assigned => new


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

Django

unread,
Aug 23, 2024, 9:21:56 AM8/23/24
to django-...@googlegroups.com
#28526: Remedy verbose, often unhelpful undefined tempate variable logging
--------------------------------------+------------------------------------
Reporter: Tim Graham | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Adam Johnson):

* cc: Adam Johnson (added)

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

Django

unread,
Aug 28, 2024, 9:02:48 AM8/28/24
to django-...@googlegroups.com
#28526: Remedy verbose, often unhelpful undefined tempate variable logging
--------------------------------------+------------------------------------
Reporter: Tim Graham | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by Natalia Bidart):

Ticket #35716 is related, possibly a duplicate.
--
Ticket URL: <https://code.djangoproject.com/ticket/28526#comment:4>

Django

unread,
Sep 24, 2025, 5:01:23 AM9/24/25
to django-...@googlegroups.com
#28526: Remedy verbose, often unhelpful undefined tempate variable logging
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* has_patch: 0 => 1
* owner: (none) => Jacob Walls
* status: new => assigned

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

Django

unread,
Sep 24, 2025, 5:02:07 AM9/24/25
to django-...@googlegroups.com
#28526: Remedy verbose, often unhelpful undefined tempate variable logging
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* needs_better_patch: 0 => 1

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

Django

unread,
Sep 24, 2025, 10:12:06 AM9/24/25
to django-...@googlegroups.com
#28526: Remedy verbose, often unhelpful undefined tempate variable logging
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* needs_better_patch: 1 => 0

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

Django

unread,
Sep 25, 2025, 2:32:44 PM9/25/25
to django-...@googlegroups.com
#28526: Remedy verbose, often unhelpful undefined template variable logging
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* summary: Remedy verbose, often unhelpful undefined tempate variable
logging => Remedy verbose, often unhelpful undefined template variable
logging

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

Django

unread,
Sep 26, 2025, 3:37:32 AM9/26/25
to django-...@googlegroups.com
#28526: Remedy verbose, often unhelpful undefined template variable logging
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/28526#comment:9>

Django

unread,
Sep 26, 2025, 8:06:50 AM9/26/25
to django-...@googlegroups.com
#28526: Remedy verbose, often unhelpful undefined template variable logging
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Sarah Boyce <42296566+sarahboyce@…>):

In [changeset:"7894776bc99e42f20e0919fc9027e6db542957d5" 7894776b]:
{{{#!CommitTicketReference repository=""
revision="7894776bc99e42f20e0919fc9027e6db542957d5"
Refs #28526 -- Provided URLResolver namespace in technical 404 template.

This avoids looking up the nonexistent "name" attribute on URLResolver,
which logs verbosely.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28526#comment:10>

Django

unread,
Sep 26, 2025, 8:07:13 AM9/26/25
to django-...@googlegroups.com
#28526: Remedy verbose, often unhelpful undefined template variable logging
--------------------------------------+------------------------------------
Reporter: Tim Graham | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Sarah Boyce):

* has_patch: 1 => 0
* owner: Jacob Walls => (none)
* stage: Ready for checkin => Accepted
* status: assigned => new

--
Ticket URL: <https://code.djangoproject.com/ticket/28526#comment:11>

Django

unread,
Mar 7, 2026, 5:21:23 AM (24 hours ago) Mar 7
to django-...@googlegroups.com
#28526: Remedy verbose, often unhelpful undefined template variable logging
--------------------------------------+------------------------------------
Reporter: Tim Graham | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by Mankameshwar Mishra):

Hi, I’d like to work on this ticket if it’s still available. Please let me
know if I can take it.
--
Ticket URL: <https://code.djangoproject.com/ticket/28526#comment:12>

Django

unread,
Mar 7, 2026, 1:14:50 PM (16 hours ago) Mar 7
to django-...@googlegroups.com
#28526: Remedy verbose, often unhelpful undefined template variable logging
--------------------------------------+------------------------------------
Reporter: Tim Graham | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by Tim Graham):

What's your proposal on how to address it?
--
Ticket URL: <https://code.djangoproject.com/ticket/28526#comment:13>

Django

unread,
Mar 7, 2026, 1:40:30 PM (15 hours ago) Mar 7
to django-...@googlegroups.com
#28526: Remedy verbose, often unhelpful undefined template variable logging
--------------------------------------+------------------------------------
Reporter: Tim Graham | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by Mankameshwar Mishra):

Thanks for the question.

My understanding is that the current logging for undefined template
variables can be very verbose and sometimes confusing, especially in cases
where missing variables are expected (e.g., optional template context
variables).

My proposal is to improve this by making the logging less noisy. For
example, we could avoid logging repeated messages for the same undefined
variable within a single template render, or adjust the message so it is
clearer and more actionable for developers.

I will first investigate where the logging is triggered in the template
engine and propose a minimal change that reduces unnecessary verbosity
while keeping useful debugging information.

Please let me know if this approach sounds reasonable.
--
Ticket URL: <https://code.djangoproject.com/ticket/28526#comment:14>

Django

unread,
Mar 7, 2026, 1:57:23 PM (15 hours ago) Mar 7
to django-...@googlegroups.com
#28526: Remedy verbose, often unhelpful undefined template variable logging
--------------------------------------+------------------------------------
Reporter: Tim Graham | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by Tim Graham):

I don't care to engage with contributors using AI.
--
Ticket URL: <https://code.djangoproject.com/ticket/28526#comment:15>
Reply all
Reply to author
Forward
0 new messages