Reference Form fields
classIntegerField(**kwargs)[source] : - Default widget: NumberInput when Field.localize is False, else TextInput. - Empty value: None - Normalizes to: A Python integer. - Validates that the given value is an integer.
1293 sections across all versions Narrow to Django 6.0 (current) →
Reference Form fields
classIntegerField(**kwargs)[source] : - Default widget: NumberInput when Field.localize is False, else TextInput. - Empty value: None - Normalizes to: A Python integer. - Validates that the given value is an integer.
Reference Form fields
classRegexField(**kwargs)[source] : - Default widget: TextInput - Empty value: Whatever you’ve given as empty_value. - Normalizes to: A string. - Uses RegexValidator to validate that the given value matches a certain regular expression. - Error message keys: required, invalid
Reference Form fields
classTypedChoiceField(**kwargs)[source] : Just like a ChoiceField, except TypedChoiceField takes two extra arguments, coerce and empty_value.
Reference Form fields Built-in Field classes
classCharField(**kwargs)[source] : - Default widget: TextInput - Empty value: Whatever you’ve given as empty_value. - Normalizes to: A string. - Uses MaxLengthValidator and MinLengthValidator if max_length and min_length are provided. Otherwise, all inputs are valid.
Reference Form fields Built-in Field classes
classIntegerField(**kwargs)[source] : - Default widget: NumberInput when Field.localize is False, else TextInput. - Empty value: None - Normalizes to: A Python integer. - Validates that the given value is an integer.
Reference Form fields Built-in Field classes
classRegexField(**kwargs)[source] : - Default widget: TextInput - Empty value: Whatever you’ve given as empty_value. - Normalizes to: A string. - Uses RegexValidator to validate that the given value matches a certain regular expression. - Error message keys: required, invalid
Reference Form fields Built-in Field classes
classTypedChoiceField(**kwargs)[source] : Just like a ChoiceField, except TypedChoiceField takes two extra arguments, coerce and empty_value.
Reference Form fields
Field.error_messages The error_messages argument lets you override the default messages that the field will raise. Pass in a dictionary with keys matching the error messages you want to override.
Reference Form fields
classNullBooleanField(**kwargs)[source] : - Default widget: NullBooleanSelect - Empty value: None - Normalizes to: A Python True, False or None value. - Validates nothing (i.e., it never raises a ValidationError).
Reference Form fields
classComboField(**kwargs)[source] : - Default widget: TextInput - Empty value: '' (an empty string) - Normalizes to: A string. - Validates the given value against each of the fields specified as an argument to the ComboField.
Reference Form fields Core field arguments
Field.error_messages The error_messages argument lets you override the default messages that the field will raise. Pass in a dictionary with keys matching the error messages you want to override.
Reference Form fields Slightly complex built-in Field classes
classComboField(**kwargs)[source] : - Default widget: TextInput - Empty value: '' (an empty string) - Normalizes to: A string. - Validates the given value against each of the fields specified as an argument to the ComboField.
Reference Form fields
classMultiValueField(fields=(),**kwargs)[source] : - Default widget: TextInput - Empty value: '' (an empty string) - Normalizes to: the type returned by the compress method of the subclass.
Reference Form fields Slightly complex built-in Field classes
classMultiValueField(fields=(),**kwargs)[source] : - Default widget: TextInput - Empty value: '' (an empty string) - Normalizes to: the type returned by the compress method of the subclass.
Reference Form fields
classJSONField(encoder=None,decoder=None,**kwargs)[source] : A field which accepts JSON encoded data for a JSONField.
Reference Form fields Built-in Field classes
classJSONField(encoder=None,decoder=None,**kwargs)[source] : A field which accepts JSON encoded data for a JSONField.
Topic guide Formsets Formset validation
You may have noticed the additional data (form-TOTAL_FORMS, form-INITIAL_FORMS) that was required in the formset’s data above. This data is required for the ManagementForm.
Topic guide Formsets Formset validation
The error_messages argument lets you override the default messages that the formset will raise. Pass in a dictionary with keys matching the error messages you want to override. Error message keys include 'too_few_forms', 'too_many_forms', and 'missing_management_form'.
Release notes Django 3.2.19 release notes
Uploading multiple files using one form field has never been supported by forms.FileField or forms.ImageField as only the last uploaded file was validated. Unfortunately, Uploading multiple files topic suggested otherwise.
Release notes Django 4.1.9 release notes
Uploading multiple files using one form field has never been supported by forms.FileField or forms.ImageField as only the last uploaded file was validated. Unfortunately, Uploading multiple files topic suggested otherwise.