mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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}, ''),
|
||||
|
||||
Reference in New Issue
Block a user