[1.11.x] Fixed #27759 -- Prevented forms attrs.html template from rendering False attrs.
Regression inb52c73008a
. Backport of5fa390ee81
from master
This commit is contained in:
parent
6969100595
commit
9e9d0f8ef7
|
@ -1 +1 @@
|
|||
{% for name, value in widget.attrs.items() %} {{ name }}{% if not value is sameas True %}="{{ value }}"{% endif %}{% endfor %}
|
||||
{% for name, value in widget.attrs.items() %}{% if value is not sameas False %} {{ name }}{% if not value is sameas True %}="{{ value }}"{% endif %}{% endif %}{% endfor %}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{% for name, value in widget.attrs.items %} {{ name }}{% if not value is True %}="{{ value }}"{% endif %}{% endfor %}
|
||||
{% for name, value in widget.attrs.items %}{% if value is not False %} {{ name }}{% if not value is True %}="{{ value }}"{% endif %}{% endif %}{% endfor %}
|
|
@ -15,3 +15,7 @@ class WidgetTests(WidgetTest):
|
|||
|
||||
def test_no_trailing_newline_in_attrs(self):
|
||||
self.check_html(Input(), 'name', 'value', strict=True, html='<input type="None" name="name" value="value" />')
|
||||
|
||||
def test_attr_false_not_rendered(self):
|
||||
html = '<input type="None" name="name" value="value" />'
|
||||
self.check_html(Input(), 'name', 'value', html=html, attrs={'readonly': False})
|
||||
|
|
Loading…
Reference in New Issue