Opened 8 years ago
Last modified 8 years ago
#28129 closed New feature
Custom template tag keyword only arguments — at Version 1
Description (last modified by ) ¶
Example tag with a keyword-only argument
@register.simple_tag(takes_context=True) def my_tag(context, arg1, *, kwarg2='n/a'): return ''
Html code
<div>bla bla bla</div> {% my_tag 'arg_1_value' kwarg_2='kwarg_value' %}
Result
django.template.exceptions.TemplateSyntaxError: 'my_tag' received unexpected keyword argument 'kwarg_2'
Note:
See TracTickets
for help on using tickets.