[Django] #36955: Add strict template variable support with global and per-variable configuration

0 views
Skip to first unread message

Django

unread,
4:57 AM (6 hours ago) 4:57 AM
to django-...@googlegroups.com
#36955: Add strict template variable support with global and per-variable
configuration
-----------------------+-------------------------------------------
Reporter: Kiran | Type: New feature
Status: new | Component: Template system
Version: 6.0 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------+-------------------------------------------
This proposal introduces optional strict handling for template variables.

Currently, Django silently renders missing variables as empty strings.
This feature would allow enabling a strict mode where undefined variables
raise an exception instead.

The proposal includes:
- A global strict template variable setting.
- Optional per-variable override behavior.
- Backward compatibility by keeping strict mode disabled by default.

Feedback is welcome before proceeding further.
--
Ticket URL: <https://code.djangoproject.com/ticket/36955>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
7:24 AM (3 hours ago) 7:24 AM
to django-...@googlegroups.com
#36955: Add strict template variable support with global and per-variable
configuration
---------------------------------+--------------------------------------
Reporter: Kiran | Owner: (none)
Type: New feature | Status: new
Component: Template system | Version: 6.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Comment (by Howard Qiu):

Here is the pull request: https://github.com/django/django/pull/20772
--
Ticket URL: <https://code.djangoproject.com/ticket/36955#comment:1>

Django

unread,
7:42 AM (3 hours ago) 7:42 AM
to django-...@googlegroups.com
#36955: Add strict template variable support with global and per-variable
configuration
---------------------------------+------------------------------------
Reporter: Kiran | Owner: (none)
Type: New feature | Status: new
Component: Template system | Version: 6.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Howard Qiu):

* has_patch: 0 => 1
* needs_docs: 0 => 1
* needs_tests: 0 => 1
* stage: Unreviewed => Accepted

Comment:

This feature seems to be good, since it's hard to find the incorrect
variable name if there aren't any exceptions.
Is it needed to add a screenshot when the context variable name is invalid
to reproduce the issue?
--
Ticket URL: <https://code.djangoproject.com/ticket/36955#comment:2>

Django

unread,
8:37 AM (2 hours ago) 8:37 AM
to django-...@googlegroups.com
#36955: Add strict template variable support with global and per-variable
configuration
-------------------------------------+-------------------------------------
Reporter: Kiran | Owner: (none)
Type: New feature | Status: closed
Component: Template system | Version: 6.0
Severity: Normal | Resolution:
| needsnewfeatureprocess
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_docs: 1 => 0
* needs_tests: 1 => 0
* resolution: => needsnewfeatureprocess
* status: new => closed

Comment:

This is being discussed at [https://github.com/django/new-
features/issues/5 the new-features repo]
--
Ticket URL: <https://code.djangoproject.com/ticket/36955#comment:3>
Reply all
Reply to author
Forward
0 new messages