Class BaseFormSet
A collection of instances of the same Form class.
Declaration
@html_safe
class BaseFormSet
source linkDocumentation
Methods
▷ def __bool__(self) Return True since all formsets have a management form which is not included in the length.
▷ def __getitem__(self, index) Return the form at the given index, based on the rendering order.
▶ def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, initial=None, ...) def __init__(
self,
data=None,
files=None,
auto_id='id_%s',
prefix=None,
initial=None,
error_class=ErrorList,
form_kwargs=None,
error_messages=None,
)
Overrides
This method is overriden in:
▷ def __iter__(self) Yield the forms in the order they should be rendered.
▶ def add_fields(self, form, index) A hook for adding extra fields on to each form instance.
Overrides
This method is overriden in:
▷ def as_p(self) Return this formset rendered as HTML <p>s.
▷ def as_table(self) Return this formset rendered as HTML <tr>s -- excluding the <table></table>.
▷ def as_ul(self) Return this formset rendered as HTML <li>s.
▶ def clean(self) Hook for doing any extra formset-wide cleaning after Form.clean() has
been called on every form. Any ValidationError raised by this method
will not be associated with a particular form; it will be accessible
via formset.non_form_errors()
Overrides
This method is overriden in:
▷ def cleaned_data(self) @property Return a list of form.cleaned_data dicts for every form in self.forms.
@property
def cleaned_data(self)
▷ def deleted_forms(self) @property Return a list of forms that have been marked for deletion.
▷ def errors(self) @property Return a list of form.errors for every form in self.forms.
@property
def errors(self)
▷ def extra_forms(self) @property Return a list of all the extra forms in this formset.
▷ def forms(self) @cached_property Instantiate forms at first property access.
▷ def full_clean(self) Clean all of self.data and populate self._errors and self._non_form_errors.
▶ def get_form_kwargs(self, index) Return additional keyword arguments for each individual formset form.
▷ def has_changed(self) Return True if data in any form differs from initial.
▶ def initial_form_count(self) Return the number of forms that are required in this FormSet.
▷ def initial_forms(self) @property Return a list of all the initial forms in this formset.
▷ def is_multipart(self) Return True if the formset needs to be multipart, i.e. it has FileInput, or False otherwise.
▷ def is_valid(self) Return True if every form in self.forms is valid.
▷ def management_form(self) @cached_property Return the ManagementForm instance for this FormSet.
▷ def media(self) @property ▷ def non_form_errors(self) Return an ErrorList of errors that aren't associated with a particular form -- i.e., from formset.clean(). Return an empty ErrorList if there are none.
▷ def ordered_forms(self) @property Return a list of form in the order specified by the incoming data. Raise an AttributeError if ordering is not allowed.
▷ def total_error_count(self) Return the number of errors across all forms in the formset.
Class methods
@classmethod
def get_default_prefix(cls)
Overrides
This method is overriden in:
Subclasses
Reexports