diff options
| author | Jannis Leidel <jannis@leidel.info> | 2011-06-11 16:05:28 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2011-06-11 16:05:28 +0000 |
| commit | d27f909d2e8e215dc9c52d090cee393a719a7965 (patch) | |
| tree | 479786711eb36bf5778d4e9aa95d678fc1b0dcee /tests | |
| parent | 4970ef07c2f6e33da26232703e542b926a1fd2e7 (diff) | |
Fixed #12847 -- Added name parameter to simple_tag, assignment_tag and inclusion_tag helpers. Thanks, vladmos.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16373 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/templates/templatetags/custom.py | 6 | ||||
| -rw-r--r-- | tests/regressiontests/templates/tests.py | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/tests/regressiontests/templates/templatetags/custom.py b/tests/regressiontests/templates/templatetags/custom.py index 2e281f7b0f..97f2674953 100644 --- a/tests/regressiontests/templates/templatetags/custom.py +++ b/tests/regressiontests/templates/templatetags/custom.py @@ -114,3 +114,9 @@ def assignment_params_and_context(context, arg): """Expected assignment_params_and_context __doc__""" return "assignment_params_and_context - Expected result (context value: %s): %s" % (context['value'], arg) assignment_params_and_context.anything = "Expected assignment_params_and_context __dict__" + +register.simple_tag(lambda x: x - 1, name='minusone') + +@register.simple_tag(name='minustwo') +def minustwo_overridden_name(value): + return value - 2 diff --git a/tests/regressiontests/templates/tests.py b/tests/regressiontests/templates/tests.py index a56168611b..36a1ca3fe0 100644 --- a/tests/regressiontests/templates/tests.py +++ b/tests/regressiontests/templates/tests.py @@ -1385,6 +1385,11 @@ class Templates(unittest.TestCase): 'templatetag11': ('{% templatetag opencomment %}', {}, '{#'), 'templatetag12': ('{% templatetag closecomment %}', {}, '#}'), + # Simple tags with customized names + 'simpletag-renamed01': ('{% load custom %}{% minusone 7 %}', {}, '6'), + 'simpletag-renamed02': ('{% load custom %}{% minustwo 7 %}', {}, '5'), + 'simpletag-renamed03': ('{% load custom %}{% minustwo_overridden_name 7 %}', {}, template.TemplateSyntaxError), + ### WIDTHRATIO TAG ######################################################## 'widthratio01': ('{% widthratio a b 0 %}', {'a':50,'b':100}, '0'), 'widthratio02': ('{% widthratio a b 100 %}', {'a':0,'b':0}, ''), |
