@register.filter(name='as_crispy_field')
def as_crispy_field(field, template_pack=TEMPLATE_PACK):
 if ((not isinstance(field, forms.BoundField)) and settings.DEBUG):
  raise CrispyError('|as_crispy_field got passed an invalid or inexistent field')
 template = get_template(('%s/field.html' % template_pack))
 c = Context({'field': field, 'form_show_errors': True, 'form_show_labels': True}).flatten()
 return template.render(c)

@ register . filter ( name = 'as_crispy_field' ) def as_crispy_field ( field , template_pack = TEMPLATE_PACK ) : if ( ( not isinstance ( field , forms . BoundField ) ) and settings . DEBUG ) : raise CrispyError ( '|as_crispy_field got passed an invalid or inexistent field' ) template = get_template ( ( '%s/field.html' % template_pack ) ) c = Context ( { 'field' : field , 'form_show_errors' : True , 'form_show_labels' : True } ) . flatten ( ) return template . render ( c )
renders a form field like a django-crispy-forms field:: {% load crispy_forms_tags %} {{ form .