diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-02-14 21:29:50 +0000 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-02-14 21:29:50 +0000 |
| commit | 2000f375cde88358cdc66f775f4de14df1234f72 (patch) | |
| tree | c524762e8f7a560a68908464976afc49a187d13f /tests | |
| parent | 803de60c088e7a439b5549575e1e3a082ae26d54 (diff) | |
Fixed #17675 -- Changed the implementation of the {% regroup %} template tag to use the context properly when resolving expressions.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17522 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/templates/tests.py | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/regressiontests/templates/tests.py b/tests/regressiontests/templates/tests.py index b067cb55b0..631c58c3a3 100644 --- a/tests/regressiontests/templates/tests.py +++ b/tests/regressiontests/templates/tests.py @@ -8,7 +8,7 @@ if __name__ == '__main__': # before importing 'template'. settings.configure() -from datetime import datetime, timedelta +from datetime import date, datetime, timedelta import time import os import sys @@ -1376,6 +1376,33 @@ class Templates(unittest.TestCase): '{% endfor %},' '{% endfor %}', {}, ''), + + # Regression tests for #17675 + # The date template filter has expects_localtime = True + 'regroup03': ('{% regroup data by at|date:"m" as grouped %}' + '{% for group in grouped %}' + '{{ group.grouper }}:' + '{% for item in group.list %}' + '{{ item.at|date:"d" }}' + '{% endfor %},' + '{% endfor %}', + {'data': [{'at': date(2012, 2, 14)}, + {'at': date(2012, 2, 28)}, + {'at': date(2012, 7, 4)}]}, + '02:1428,07:04,'), + # The join template filter has needs_autoescape = True + 'regroup04': ('{% regroup data by bar|join:"" as grouped %}' + '{% for group in grouped %}' + '{{ group.grouper }}:' + '{% for item in group.list %}' + '{{ item.foo|first }}' + '{% endfor %},' + '{% endfor %}', + {'data': [{'foo': 'x', 'bar': ['ab', 'c']}, + {'foo': 'y', 'bar': ['a', 'bc']}, + {'foo': 'z', 'bar': ['a', 'd']}]}, + 'abc:xy,ad:z,'), + ### SSI TAG ######################################################## # Test normal behavior |
