fairdm.forms.base#
Base form classes configured through options on their Meta.
Module Contents#
Classes#
Metaclass mixin that collects FairDM options from a form’s |
|
Metaclass for :class: |
|
Metaclass for :class: |
|
Mixin that applies the FairDM |
|
Base form for FairDM, configured through options on its |
|
Base model form for FairDM, configured through options on its |
API#
- class BaseMetaClass[source]#
Metaclass mixin that collects FairDM options from a form’s
Meta.The options are merged with those of the base classes and stored on the form class as
_custom_conf. They are removed fromMetaso Django never sees them.Meta.fieldsis flattened, or taken fromMeta.fieldsetswhen set.
- class FairDMModelFormMetaclass[source]#
Bases:
fairdm.forms.base.BaseMetaClass,django.forms.models.ModelFormMetaclassMetaclass for :class:
ModelFormthat reads FairDMMetaoptions.
- class FairDMFormMetaclass[source]#
Bases:
fairdm.forms.base.BaseMetaClass,django.forms.forms.DeclarativeFieldsMetaclassMetaclass for :class:
Formthat reads FairDMMetaoptions.
- class FairDMFormMixin(*args, **kwargs)[source]#
Mixin that applies the FairDM
Metaoptions to a form.The options are read by :class:
BaseMetaClassinto_custom_conf:formfield_overrides: maps a model field type to the form field class used for it. Fields declared on the form are left alone.field_overrides: maps a field name to a dict of attributes set on that field.explicit_fields: whenTrue, drop every field not inMeta.fields.fieldsets: grouped fields, used for the crispy layout andMeta.fields.form_attrs: HTML attributes for the<form>element.helper_attrs: attributes set on the crispyFormHelper.help_text: HTML shown above the form fields.
Initialization
- get_layout()[source]#
Build the crispy layout for this form.
Uses
fieldsetswhen configured, then the configuredfields, thenMeta.fields. Override it to provide a custom layout.Returns: The layout, empty when the form declares no fields.
- class Form(*args, **kwargs)[source]#
Bases:
fairdm.forms.base.FairDMFormMixin,django.forms.FormBase form for FairDM, configured through options on its
Meta.Initialization