Skip to main content

ModelForm

No overview available.

Constructor

Signature

def ModelForm() - > null

Signature

def ModelForm(
data: dict = None,
files: dict = None,
auto_id: str = 'id_%s',
prefix: str = None,
initial: dict = None,
error_class: type = ErrorList,
label_suffix: str = None,
empty_permitted: bool = False,
instance: object = None,
use_required_attribute: bool = None,
renderer: object = None
) - > null

Parameters

NameTypeDescription
datadict = NoneA dictionary-like object containing the submitted form data to be validated.
filesdict = NoneA dictionary-like object containing uploaded file data.
auto_idstr = 'id_%s'The format string used to generate HTML ID attributes for form fields.
prefixstr = NoneA string used to prefix every HTML field name to allow multiple forms on the same page.
initialdict = NoneA dictionary of initial values to populate the form fields before user input.
error_classtype = ErrorListThe class used to represent and render form validation errors.
label_suffixstr = NoneThe character or string to append after every field label when rendered.
empty_permittedbool = FalseA flag indicating whether the form can be submitted with no data without raising validation errors.
instanceobject = NoneAn existing model instance to be updated by the form; if provided, the form will be pre-populated with its data.
use_required_attributebool = NoneWhether to include the 'required' HTML attribute on supported form widgets.
rendererobject = NoneThe engine used to render the form into HTML templates.