forms.MultiValueField.fields

fields A tuple of fields whose values are cleaned and subsequently combined into a single value. Each value of the field is cleaned by the corresponding field in fields – the first value is cleaned by the first field, the second value is cleaned by the second field, etc. Once all fields are cleaned, the list of clean values is combined into a single value by compress(). Also takes one extra optional argument:

forms.MultiValueField.require_all_fields

require_all_fields Defaults to True, in which case a required validation error will be raised if no value is supplied for any field. When set to False, the Field.required attribute can be set to False for individual fields to make them optional. If no value is supplied for a required field, an incomplete validation error will be raised. A default incomplete error message can be defined on the MultiValueField subclass, or different messages can be defined on each individual field. For example

forms.MultipleHiddenInput.choices

choices This attribute is optional when the form field does not have a choices attribute. If it does, it will override anything you set here when the attribute is updated on the Field.

forms.MultipleHiddenInput

class MultipleHiddenInput [source] Multiple <input type='hidden' ...> widgets. A widget that handles multiple hidden widgets for fields that have a list of values. choices This attribute is optional when the form field does not have a choices attribute. If it does, it will override anything you set here when the attribute is updated on the Field.

forms.models.modelform_factory()

modelform_factory(model, form=ModelForm, fields=None, exclude=None, formfield_callback=None, widgets=None, localized_fields=None, labels=None, help_texts=None, error_messages=None, field_classes=None) [source] Returns a ModelForm class for the given model. You can optionally pass a form argument to use as a starting point for constructing the ModelForm. fields is an optional list of field names. If provided, only the named fields will be included in the returned fields. exclude is an optiona

forms.models.inlineformset_factory()

inlineformset_factory(parent_model, model, form=ModelForm, formset=BaseInlineFormSet, fk_name=None, fields=None, exclude=None, extra=3, can_order=False, can_delete=True, max_num=None, formfield_callback=None, widgets=None, validate_max=False, localized_fields=None, labels=None, help_texts=None, error_messages=None, min_num=None, validate_min=False, field_classes=None) [source] Returns an InlineFormSet using modelformset_factory() with defaults of formset=BaseInlineFormSet, can_delete=True, a

forms.MultipleChoiceField

class MultipleChoiceField(**kwargs) [source] Default widget: SelectMultiple Empty value: [] (an empty list) Normalizes to: A list of Unicode objects. Validates that every value in the given list of values exists in the list of choices. Error message keys: required, invalid_choice, invalid_list The invalid_choice error message may contain %(value)s, which will be replaced with the selected choice. Takes one extra required argument, choices, as for ChoiceField.

forms.models.modelformset_factory()

modelformset_factory(model, form=ModelForm, formfield_callback=None, formset=BaseModelFormSet, extra=1, can_delete=False, can_order=False, max_num=None, fields=None, exclude=None, widgets=None, validate_max=False, localized_fields=None, labels=None, help_texts=None, error_messages=None, min_num=None, validate_min=False, field_classes=None) [source] Returns a FormSet class for the given model class. Arguments model, form, fields, exclude, formfield_callback, widgets, localized_fields, labels,

forms.models.BaseInlineFormSet

class models.BaseInlineFormSet Inline formsets is a small abstraction layer on top of model formsets. These simplify the case of working with related objects via a foreign key. Suppose you have these two models: from django.db import models class Author(models.Model): name = models.CharField(max_length=100) class Book(models.Model): author = models.ForeignKey(Author, on_delete=models.CASCADE) title = models.CharField(max_length=100) If you want to create a formset that allows

forms.models.BaseModelFormSet.deleted_objects

models.BaseModelFormSet.deleted_objects