#35716: #35189 brokes admin/[model]/add pages when application does not allow
undefined variables on templates
---------------------------------+-----------------------------------------
Reporter: Fábio Domingues | Type: Bug
Status: new | Component: contrib.admin
Version: 5.1 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+-----------------------------------------
Applications that does not forgive undefined variables on templates, for
example using this:
{{{
# Raise an exception when accessing an undefined variable in templates
class InvalidString(str):
def __mod__(self, other):
from django.template.base import TemplateSyntaxError
raise TemplateSyntaxError(f"Undefined variable or unknown value
for: {other}")
}}}
raises an error "Undefined variable or unknown value for:
fieldset.formset.prefix" on line 1 of
django/contrib/admin/templates/admin/includes/fieldset.html
My sugestion is to use firstof tags instead of the with tag.
--
Ticket URL: <https://code.djangoproject.com/ticket/35716>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070191988d47c1-f50f73d9-d492-4911-9b14-bbe8ef72714d-000000%40eu-central-1.amazonses.com.