

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

dataset/ETHPy150Open maraujop/django-crispy-forms/crispy_forms/templatetags/crispy_forms_filters.py as_crispy_errors/original