Fixed #12199 -- Added the ability to use "as" with the firstof template tag.

This commit is contained in:
Craig Oldford 2015-04-13 12:27:30 -03:00 committed by Tim Graham
parent 6023312dde
commit 75bc5bc634
4 changed files with 31 additions and 4 deletions

View file

@ -81,3 +81,10 @@ class FirstOfTagTests(SimpleTestCase):
def test_firstof14(self):
output = self.engine.render_to_string('firstof14', {'a': '<'})
self.assertEqual(output, '<')
@setup({'firstof15': '{% firstof a b c as myvar %}'})
def test_firstof15(self):
ctx = {'a': 0, 'b': 2, 'c': 3}
output = self.engine.render_to_string('firstof15', ctx)
self.assertEqual(ctx['myvar'], '2')
self.assertEqual(output, '')