Form widgets¶
djangocms-frontend contains button group widgets which can be used as
for forms.ChoiceField. They might turn out helpful when adding custom
plugins.
- class ButtonGroup(forms.RadioSelect)¶
Import from
djangocms_frontend.fieldsThe button group widget displays a set of buttons for the user to chose. Usable for up to roughly five options.
- class ColoredButtonGroup(ButtonGroup)¶
Import from
djangocms_frontend.fieldsUsed to display the context color selection buttons.
- class IconGroup(ButtonGroup)¶
Import from
djangocms_frontend.fields.This widget displays icons in stead of text for the options. Each icon is rendered by
<span class="icon icon-{{value}}"></span>. Add css in theMediasubclass to ensure that for each option’s value the span renders the appropriate icon.
- class IconMultiselect(forms.CheckboxSelectMultiple)¶
Import from
djangocms_frontend.fields.Like
IconGroupthis widget displays a choice of icons. Since it inherits fromCheckboxSelectMultiplethe icons work like checkboxes and not radio buttons.
- class OptionalDeviceChoiceField(forms.MultipleChoiceField)¶
Import from
djangocms_frontend.fields.This form field displays a choice of devices corresponding to breakpoints in the responsive grid. The user can select any combination of devices including none and all.
The result is a list of values of the selected choices or None for all devices selected.
- class DeviceChoiceField(OptionalDeviceChoiceField)¶
Import from
djangocms_frontend.fields.This form field is identical to the
OptionalDeviceChoiceFieldabove, but requires the user to select at least one device.