@register.tag
def annotate_form_field(parser, token):
 args = token.split_contents()
 if (len(args) < 2):
  raise template.TemplateSyntaxError('annotate_form_field tag requires a form field to be passed')
 return FormFieldNode(args[1])

@ register . tag def annotate_form_field ( parser , token ) : args = token . split_contents ( ) if ( len ( args ) < 2 ) : raise template . TemplateSyntaxError ( 'annotate_form_field tag requires a form field to be passed' ) return FormFieldNode ( args [ 1 ] )
set an attribute on a form field with the widget type this means templates can use the widget type to render things differently if they want to .