Fields

References
class crispy_forms_foundation.layout.fields.Field(*args, **kwargs)

Bases: crispy_forms.layout.Field

Layout object, contain one field name and you can add attributes to it easily. For setting class attributes, you need to use css_class, because class is a reserved Python keyword.

Example:

Field('field_name', style="color: #333;", css_class="whatever",
      id="field_name")
class crispy_forms_foundation.layout.fields.MultiField(label, *fields, **kwargs)

Bases: crispy_forms.layout.MultiField

MultiField container. Render to a MultiField

class crispy_forms_foundation.layout.fields.SplitDateTimeField(*args, **kwargs)

Bases: crispy_forms_foundation.layout.fields.Field

Just an inherit from crispy_forms.layout.Field to have a common Field for displaying field with the django.forms.extra.SplitDateTimeWidget widget.

Simply use a specific template

class crispy_forms_foundation.layout.fields.InlineField(field, label_column='large-3', input_column='large-9', label_class='', *args, **kwargs)

Bases: crispy_forms_foundation.layout.fields.Field

Layout object for rendering an inline field with Foundation

Example:

InlineField('field_name')

Or:

InlineField('field_name', label_column='large-8',
            input_column='large-4', label_class='')

label_column, input_column, label_class, are optional argument.

class crispy_forms_foundation.layout.fields.InlineJustifiedField(field, *args, **kwargs)

Bases: crispy_forms_foundation.layout.fields.InlineField

Same as InlineField but default is to be right aligned with a vertical padding

class crispy_forms_foundation.layout.fields.SwitchField(field, *args, **kwargs)

Bases: crispy_forms_foundation.layout.fields.Field

A specific field to use Foundation form switches

You must only use this with a checkbox field and this is a raw usage of this Foundation element, you should see InlineSwitchField instead.

Example:

SwitchField('field_name', style="color: #333;", css_class="whatever",
            id="field_name")
class crispy_forms_foundation.layout.fields.InlineSwitchField(field, *args, **kwargs)

Bases: crispy_forms_foundation.layout.fields.InlineField

Like SwitchField it use Foundation form switches with checkbox field but within an InlineField

Contrary to SwitchField this play nice with the label to be able to display it (as Foundation form switches default behavior is to hide the label text)

Example:

InlineSwitchField('field_name')

Or:

InlineSwitchField('field_name', label_column='large-8',
                  input_column='large-4', label_class='',
                  switch_class="inline")

label_column, input_column, label_class, switch_class are optional argument.