[Django] #36658: Invalid numeric literal in an {% if %} tag is treated as a variable

6 views
Skip to first unread message

Django

unread,
Oct 11, 2025, 12:22:48 PM10/11/25
to django-...@googlegroups.com
#36658: Invalid numeric literal in an {% if %} tag is treated as a variable
----------------------+-------------------------------------------
Reporter: Lily | Type: Bug
Status: new | Component: Template system
Version: 5.2 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
----------------------+-------------------------------------------
I would expect the following template to raise a `TemplateSyntaxError`
during parsing:

{{{
{% if 1.1.1 %}foo{% endif %}
}}}

Instead, the `1.1.1` is treated as a variable name, so this will render an
empty string (or `"foo"` if the context looks like `{"1": {"1": {"1":
"bar"}}}` or similar).
--
Ticket URL: <https://code.djangoproject.com/ticket/36658>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 12, 2025, 9:33:40 AM10/12/25
to django-...@googlegroups.com
#36658: Invalid numeric literal in an {% if %} tag is treated as a variable
---------------------------------+--------------------------------------
Reporter: Lily | Owner: (none)
Type: Bug | Status: new
Component: Template system | Version: 5.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by segnimekonnen7):

* has_patch: 0 => 1

Comment:

PR: https://github.com/django/django/pull/19944
--
Ticket URL: <https://code.djangoproject.com/ticket/36658#comment:1>

Django

unread,
Oct 14, 2025, 2:25:29 PM10/14/25
to django-...@googlegroups.com
#36658: Invalid numeric literal in an {% if %} tag is treated as a variable
---------------------------------+--------------------------------------
Reporter: Lily | Owner: (none)
Type: New feature | Status: closed
Component: Template system | Version: 5.2
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Natalia Bidart):

* easy: 1 => 0
* resolution: => wontfix
* status: new => closed
* type: Bug => New feature

Comment:

Hello Lily, thank you for your ticket. Please note that this is well
documented, well tested behavior. Any change in this area should be widely
discussed and agreed with the Django community, with a clear deprecation
plan. The current semantic has been in place for ages and it's more than
likely that many projects out there rely on this behavior.

Since this can't be treated as a bug nor as a cleanup, this qualifies as a
New Feature, so this idea should first be proposed and discussed with the
community. To do that, please raise this on the [https://github.com/django
/new-features/issues ​new feature tracker].

I'll close the ticket for now, but if the community agrees with the
proposal, please return to this ticket and reference the forum discussion
so we can re-open it. For more information, please refer to
[https://docs.djangoproject.com/en/stable/internals/contributing/bugs-and-
features/#requesting-features the documented guidelines for requesting
features].
--
Ticket URL: <https://code.djangoproject.com/ticket/36658#comment:2>
Reply all
Reply to author
Forward
0 new messages