[1.11.x] Fixed #27761 -- Fixed quote location in multiple_input.html forms templates.
Backport of 88183117c2
from master
This commit is contained in:
parent
e4dab20a27
commit
6969100595
|
@ -1,5 +1,5 @@
|
||||||
{% set id = widget.attrs.id %}<ul{% if id %} id="{{ id }}"{% endif %}>{% for group, options, index in widget.optgroups %}{% if group %}
|
{% set id = widget.attrs.id %}<ul{% if id %} id="{{ id }}"{% endif %}>{% for group, options, index in widget.optgroups %}{% if group %}
|
||||||
<li>{{ group }}<ul{% if id %} id="{{ id }}_{{ index }}{% endif %}">{% endif %}{% for widget in options %}
|
<li>{{ group }}<ul{% if id %} id="{{ id }}_{{ index }}"{% endif %}>{% endif %}{% for widget in options %}
|
||||||
<li>{% include widget.template_name %}</li>{% endfor %}{% if group %}
|
<li>{% include widget.template_name %}</li>{% endfor %}{% if group %}
|
||||||
</ul></li>{% endif %}{% endfor %}
|
</ul></li>{% endif %}{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% with id=widget.attrs.id %}<ul{% if id %} id="{{ id }}"{% endif %}>{% for group, options, index in widget.optgroups %}{% if group %}
|
{% with id=widget.attrs.id %}<ul{% if id %} id="{{ id }}"{% endif %}>{% for group, options, index in widget.optgroups %}{% if group %}
|
||||||
<li>{{ group }}<ul{% if id %} id="{{ id }}_{{ index }}{% endif %}">{% endif %}{% for option in options %}
|
<li>{{ group }}<ul{% if id %} id="{{ id }}_{{ index }}"{% endif %}>{% endif %}{% for option in options %}
|
||||||
<li>{% include option.template_name with widget=option %}</li>{% endfor %}{% if group %}
|
<li>{% include option.template_name with widget=option %}</li>{% endfor %}{% if group %}
|
||||||
</ul></li>{% endif %}{% endfor %}
|
</ul></li>{% endif %}{% endfor %}
|
||||||
</ul>{% endwith %}
|
</ul>{% endwith %}
|
||||||
|
|
|
@ -78,6 +78,41 @@ class CheckboxSelectMultipleTest(WidgetTest):
|
||||||
attrs={'id': 'media'}, html=html,
|
attrs={'id': 'media'}, html=html,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_nested_choices_without_id(self):
|
||||||
|
nested_choices = (
|
||||||
|
('unknown', 'Unknown'),
|
||||||
|
('Audio', (('vinyl', 'Vinyl'), ('cd', 'CD'))),
|
||||||
|
('Video', (('vhs', 'VHS'), ('dvd', 'DVD'))),
|
||||||
|
)
|
||||||
|
html = """
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<label><input name="nestchoice" type="checkbox" value="unknown" /> Unknown</label>
|
||||||
|
</li>
|
||||||
|
<li>Audio<ul>
|
||||||
|
<li>
|
||||||
|
<label>
|
||||||
|
<input checked name="nestchoice" type="checkbox" value="vinyl" /> Vinyl
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label><input name="nestchoice" type="checkbox" value="cd" /> CD</label>
|
||||||
|
</li>
|
||||||
|
</ul></li>
|
||||||
|
<li>Video<ul>
|
||||||
|
<li>
|
||||||
|
<label><input name="nestchoice" type="checkbox" value="vhs" /> VHS</label>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label>
|
||||||
|
<input checked name="nestchoice" type="checkbox" value="dvd" /> DVD
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
</ul></li>
|
||||||
|
</ul>
|
||||||
|
"""
|
||||||
|
self.check_html(self.widget(choices=nested_choices), 'nestchoice', ('vinyl', 'dvd'), html=html)
|
||||||
|
|
||||||
def test_separate_ids(self):
|
def test_separate_ids(self):
|
||||||
"""
|
"""
|
||||||
Each input gets a separate ID.
|
Each input gets a separate ID.
|
||||||
|
|
Loading…
Reference in New Issue