Ticket #15138: inclusion_tag_doc.diff

File inclusion_tag_doc.diff, 816 bytes (added by elbarto, 4 years ago)
  • docs/howto/custom-template-tags.txt

     
    667667``takes_context`` argument when registering your tag::
    668668
    669669    # The first argument *must* be called "context" here.
    670     def current_time(context, format_string):
     670    def current_time(context):
    671671        timezone = context['timezone']
    672672        return your_get_current_time_method(timezone)
    673673
     
    676676Or, using decorator syntax::
    677677
    678678    @register.simple_tag(takes_context=True)
    679     def current_time(context, format_string):
     679    def current_time(context):
    680680        timezone = context['timezone']
    681681        return your_get_current_time_method(timezone)
    682682
Back to Top