Form
A collection of Fields, plus their associated data.
Constructor
Signature
def Form(
data: dict = null,
files: dict = null,
auto_id: str|bool = 'id_%s',
prefix: str = null,
initial: dict = null,
error_class: type = ErrorList,
label_suffix: str = null,
empty_permitted: bool = false,
field_order: list = null,
use_required_attribute: bool = null,
renderer: [BaseRenderer](../renderers/baserenderer.md?sid=django_forms_renderers_baserenderer) = null
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| data | dict = null | A dictionary-like object containing the data to be validated. |
| files | dict = null | A dictionary-like object containing uploaded file data. |
| auto_id | `str | bool` = 'id_%s' |
| prefix | str = null | A prefix to be prepended to all field names in the HTML representation. |
| initial | dict = null | A dictionary containing initial values for the fields. |
| error_class | type = ErrorList | The class used to display error messages. |
| label_suffix | str = null | The character(s) to append after every field label. |
| empty_permitted | bool = false | Whether the form is allowed to be empty. |
| field_order | list = null | A list of field names to define the order in which they are rendered. |
| use_required_attribute | bool = null | Whether to use the 'required' HTML attribute on inputs. |
| renderer | [BaseRenderer](../renderers/baserenderer.md?sid=django_forms_renderers_baserenderer) = null | The renderer instance used to render the form to HTML. |
Signature
def Form(
data: dict = null,
files: dict = null,
auto_id: string|boolean = 'id_%s',
prefix: string = null,
initial: dict = null,
error_class: type = ErrorList,
label_suffix: string = null,
empty_permitted: boolean = false,
field_order: list,
use_required_attribute: boolean = null,
renderer: [BaseRenderer](../renderers/baserenderer.md?sid=django_forms_renderers_baserenderer) = null
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| data | dict = null | A dictionary-like object containing the submitted form data to be validated. |
| files | dict = null | A dictionary-like object containing uploaded file data. |
| auto_id | `string | boolean` = 'id_%s' |
| prefix | string = null | A string used to namespace form fields, preventing name collisions when multiple forms are rendered in one view. |
| initial | dict = null | A dictionary of initial values to populate form fields when the form is unbound. |
| error_class | type = ErrorList | The class used to render and manage form error messages. |
| label_suffix | string = null | A string to append to every field label when the form is rendered. |
| empty_permitted | boolean = false | If true, the form is allowed to be empty and will not raise validation errors if no data is provided. |
| field_order | list | A list of field names specifying the order in which fields should be rendered. |
| use_required_attribute | boolean = null | Determines whether to add the 'required' HTML attribute to required field widgets. |
| renderer | [BaseRenderer](../renderers/baserenderer.md?sid=django_forms_renderers_baserenderer) = null | The engine used to render the form into HTML templates. |