

@register.filter(name='crispy')
def as_crispy_form(form, template_pack=TEMPLATE_PACK, label_class='', field_class=''):
    '\n    The original and still very useful way to generate a div elegant form/formset::\n\n        {% load crispy_forms_tags %}\n\n        <form class="uniForm" method="post">\n            {% csrf_token %}\n            {{ myform|crispy }}\n        </form>\n\n    or, if you want to explicitly set the template pack::\n\n        {{ myform|crispy:"bootstrap" }}\n\n    In ``bootstrap3`` or ``bootstrap4`` for horizontal forms you can do::\n\n        {{ myform|label_class:"col-lg-2",field_class:"col-lg-8" }}\n    '
    if isinstance(form, BaseFormSet):
        template = uni_formset_template(template_pack)
        c = Context({
            'formset': form,
            'form_show_errors': True,
            'form_show_labels': True,
            'label_class': label_class,
            'field_class': field_class,
        })
    else:
        template = uni_form_template(template_pack)
        c = Context({
            'form': form,
            'form_show_errors': True,
            'form_show_labels': True,
            'label_class': label_class,
            'field_class': field_class,
        })
    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_form/original