#27759: Template widget rendering: attrs with value False now render
----------------------------------------+------------------------
Reporter: Jon Dufresne | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.11
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 |
----------------------------------------+------------------------
In Django 1.10, widget attrs with a value of `False` do not render. See
the code:
https://github.com/django/django/blob/stable/1.10.x/django/forms/utils.py#L40-L42
In Django 1.11, these attributes now render as `="False"`. This is because
the
[https://github.com/django/django/blob/12cefee5d84b3569ccbde03167c7853e8dac638f/django/forms/templates/django/forms/widgets/attrs.html
attrs.html template] only looks for the boolean value `True`.
This forces code of the form:
{{{
attrs['readonly'] = some_bool_condition()
}}}
To:
{{{
if some_bool_condition():
attrs['readonly'] = True
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27759>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.dd8be3aedbdd9f550c2e5822df8d78f2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.