mirror of https://github.com/django/django.git
Fixed #15138 -- Clarified a slightly ambiguous example in the custom template tag docs. Thanks to elbarto for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15448 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
327d69de73
commit
f80e997c50
|
@ -669,7 +669,7 @@ If your template tag needs to access the current context, you can use the
|
||||||
# The first argument *must* be called "context" here.
|
# The first argument *must* be called "context" here.
|
||||||
def current_time(context, format_string):
|
def current_time(context, format_string):
|
||||||
timezone = context['timezone']
|
timezone = context['timezone']
|
||||||
return your_get_current_time_method(timezone)
|
return your_get_current_time_method(timezone, format_string)
|
||||||
|
|
||||||
register.simple_tag(takes_context=True)(current_time)
|
register.simple_tag(takes_context=True)(current_time)
|
||||||
|
|
||||||
|
@ -678,7 +678,7 @@ Or, using decorator syntax::
|
||||||
@register.simple_tag(takes_context=True)
|
@register.simple_tag(takes_context=True)
|
||||||
def current_time(context, format_string):
|
def current_time(context, format_string):
|
||||||
timezone = context['timezone']
|
timezone = context['timezone']
|
||||||
return your_get_current_time_method(timezone)
|
return your_get_current_time_method(timezone, format_string)
|
||||||
|
|
||||||
For more information on how the ``takes_context`` option works, see the section
|
For more information on how the ``takes_context`` option works, see the section
|
||||||
on `inclusion tags`_.
|
on `inclusion tags`_.
|
||||||
|
|
Loading…
Reference in New Issue