#27759 closed Bug (fixed)
Template widget rendering: attrs with value False now render
Reported by: | Jon Dufresne | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 1.11 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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 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
Change History (5)
comment:1 by , 8 years ago
Has patch: | set |
---|---|
Needs tests: | set |
comment:3 by , 8 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
Note:
See TracTickets
for help on using tickets.
PR