#31536: Disabled clearable file field widget is not disabling the checkbox
-------------------------------------+-------------------------------------
Reporter: Carles Pina Estany | Owner: Carles
| Pina Estany
Type: Bug | Status: closed
Component: Forms | Version: dev
Severity: Normal | Resolution: fixed
Keywords: form, filefield, | Triage Stage: Ready for
clearable_file_input | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Comment (by suspectpart):
It seems like the fix to this issue raised a problem similar to Ticket
#32681: Not checking whether the `disabled` attribute actually exists on
the `attrs` of the 'clear' checkbox causes a `VariableDoesNotExist`
exception to be logged every time the template is rendered with a checkbox
that has no `disabled` atrribute:
{{{
[2022-07-06 10:06:03,452] DEBUG django.template base: Exception while
resolving variable 'disabled' in template
'admin/widgets/clearable_file_input.html'.
Traceback (most recent call last):
File "/home/horst/some_project/venv/lib/python3.10/site-
packages/django/template/base.py", line 875, in _resolve_lookup
current = current[bit]
KeyError: 'disabled'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/horst/some_project/venv/lib/python3.10/site-
packages/django/template/base.py", line 885, in _resolve_lookup
current = getattr(current, bit)
AttributeError: 'dict' object has no attribute 'disabled'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/horst/some_project/venv/lib/python3.10/site-
packages/django/template/base.py", line 891, in _resolve_lookup
current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'disabled'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/horst/some_project/venv/lib/python3.10/site-
packages/django/template/base.py", line 898, in _resolve_lookup
raise VariableDoesNotExist(
django.template.base.VariableDoesNotExist: Failed lookup for key
[disabled] in {'id': 'id_document'}
}}}
Should this be a new ticket?
--
Ticket URL: <https://code.djangoproject.com/ticket/31536#comment:12>
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/01070181d29c6803-8d6c61ee-2ce9-4cc6-8af4-13dfba2ccacf-000000%40eu-central-1.amazonses.com.