@register.filter(name='as_crispy_errors')
def as_crispy_errors(form, template_pack=TEMPLATE_PACK):
 if isinstance(form, BaseFormSet):
  template = get_template(('%s/errors_formset.html' % template_pack))
  c = Context({'formset': form}).flatten()
 else:
  template = get_template(('%s/errors.html' % template_pack))
  c = Context({'form': form}).flatten()
 return template.render(c)

@ register . filter ( name = 'as_crispy_errors' ) def as_crispy_errors ( form , template_pack = TEMPLATE_PACK ) : if isinstance ( form , BaseFormSet ) : template = get_template ( ( '%s/errors_formset.html' % template_pack ) ) c = Context ( { 'formset' : form } ) . flatten ( ) else : template = get_template ( ( '%s/errors.html' % template_pack ) ) c = Context ( { 'form' : form } ) . flatten ( ) return template . render ( c )
renders only form errors the same way as django-crispy-forms:: {% load crispy_forms_tags %} {{ form|as_crispy_errors }} or:: {{ form|as_crispy_errors:"bootstrap" }} .