simple_tag像 Python 调用一样工作。  
如果您True在模板中传递文字,它将被视为命名变量True并在模板上下文中进行搜索。如果没有True定义,只要''字段是.Falsecropmodels.BooleanField
例如,
在 foo/templatetags/foo.py
from django import template
register = template.Library()
def test(x, y=False, **kwargs):
    return unicode(locals())
在壳里
>>> from django.template import Template, Context
>>> t = Template("{% load foo %}{% test 1 True z=42 %}")
>>> print t.render(Context())
{'y': '', 'x': 1, 'kwargs': {'z': 42}}
# you could define True in context
>>> print t.render(Context({'True':True}))
{'y': True, 'x': 1, 'kwargs': {'z': 42}}
# Also you could use other value such as 1 or 'True' which could be coerced to True
>>> t = Template("{% load foo %}{% test 1 1 z=42 %}")
>>> print t.render(Context())
{'y': 1, 'x': 1, 'kwargs': {'z': 42}}
>>> t = Template("{% load foo %}{% test 1 'True' z=42 %}")
>>> print t.render(Context())
{'y': 'True', 'x': 1, 'kwargs': {'z': 42}}