#36692: TemplateSyntaxError in clearable_file_input.html due to unbalanced
template
logic
-------------------------------------+-------------------------------------
Reporter: keranbyge | Type: Bug
Status: new | Component:
| contrib.admin
Version: 5.2 | Severity: Normal
Keywords: admin_widgets, | Triage Stage:
template, AdminFileWidget, | Unreviewed
TemplateSyntaxError |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Problem
-------
Running the admin_widgets tests locally raised a TemplateSyntaxError from:
django/contrib/admin/templates/admin/widgets/clearable_file_input.html
The template had mismatched conditional block logic (an `{% else %}` / `{%
endif %}` placement issue), which caused the Django template parser to
fail when rendering AdminFileWidget in tests.
Reproduction
----------
Run locally:
python tests/runtests.py admin_widgets -v 2
Observed a TemplateSyntaxError during template parsing in
clearable_file_input.html.
Fix
---
Adjusted the conditional structure in clearable_file_input.html to
properly balance `{% if %}` / `{% else %}` / `{% endif %}` blocks. This
allows the AdminFileWidget to render as expected.
Verification
----------
I ran:
python tests/runtests.py admin_widgets -v 2
All admin_widgets tests passed successfully after the fix.
Patch / PR
----------
PR: https://github.com/keranbyge/django/pull/20008
--
Ticket URL: <https://code.djangoproject.com/ticket/36692>
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 visit
https://groups.google.com/d/msgid/django-updates/0107019a299108c0-6b140364-0f51-4959-aacd-474ec3c6becf-000000%40eu-central-1.amazonses.com.