mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #27058 -- Reallowed the {% for %} tag to unpack any iterable.
Thanks Sergei Maertens for the report and patch.
This commit is contained in:
parent
21aec54296
commit
937d752d3d
3 changed files with 10 additions and 3 deletions
|
@ -126,6 +126,11 @@ class ForTagTests(SimpleTestCase):
|
|||
output = self.engine.render_to_string('for-tag-filter-ws', {'s': 'abc'})
|
||||
self.assertEqual(output, 'abc')
|
||||
|
||||
@setup({'for-tag-unpack-strs': '{% for x,y in items %}{{ x }}:{{ y }}/{% endfor %}'})
|
||||
def test_for_tag_unpack_strs(self):
|
||||
output = self.engine.render_to_string('for-tag-unpack-strs', {'items': ('ab', 'ac')})
|
||||
self.assertEqual(output, 'a:b/a:c/')
|
||||
|
||||
@setup({'for-tag-unpack10': '{% for x,y in items %}{{ x }}:{{ y }}/{% endfor %}'})
|
||||
def test_for_tag_unpack10(self):
|
||||
with self.assertRaisesMessage(ValueError, 'Need 2 values to unpack in for loop; got 3.'):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue