UI Samples

Horizontal form via object manipulation

A form rendered in horizontal layout by manipulating the form helper object in the view.

Rendered with

{% load crispy_forms_tags %}

{% crispy form %}

The layout is forced to horizontal by overriding get_form() in the view class:

def get_form(self, form_class=None):
    form = super().get_form(form_class=form_class)
    form.helper.form_class = 'form-horizontal'
    form.helper.label_class = "col-lg-2"
    form.helper.field_class = "col-lg-8"
    return form

A brief message (optional)