Reference
Form validation happens when the data is cleaned. If you want to customize this process, there are various places to make changes, each one serving a different purpose. Three types of cleaning methods are run during form processing.
1293 sections across all versions Narrow to Django 6.0 (current) →
Reference
Form validation happens when the data is cleaned. If you want to customize this process, there are various places to make changes, each one serving a different purpose. Three types of cleaning methods are run during form processing.
Reference
Form validation happens when the data is cleaned. If you want to customize this process, there are various places to make changes, each one serving a different purpose. Three types of cleaning methods are run during form processing.
Topic guide Creating forms from models
There are two main steps involved in validating a ModelForm: Validating the form Validating the model instance Just like normal form validation, model form validation is triggered implicitly when calling is_valid() or accessing the errors attribute and explicitly when calling …
Topic guide Creating forms from models ModelForm
There are two main steps involved in validating a ModelForm: Validating the form Validating the model instance Just like normal form validation, model form validation is triggered implicitly when calling is_valid() or accessing the errors attribute and explicitly when calling …
Reference The Django admin site
The admin uses ModelForm. To add custom validation, provide your own ModelForm: Then configure the ModelAdmin to use the form: Or configure an InlineModelAdmin to use the form: It is important that you use a ModelForm; otherwise things can break.
Reference The Django admin site
The admin uses ModelForm. To add custom validation, provide your own ModelForm: Then configure the ModelAdmin to use the form: Or configure an InlineModelAdmin to use the form: It is important that you use a ModelForm; otherwise things can break.
Topic guide Creating forms from models
As part of the validation process, ModelForm will call the clean() method of each field on your model that has a corresponding field on your form.
Topic guide Creating forms from models ModelFormValidation on a ModelForm
As part of the validation process, ModelForm will call the clean() method of each field on your model that has a corresponding field on your form.
Reference Validators
See the form validation for more information on how validators are run in forms, and Validating objects for how they’re run in models.
Reference Validators
See the form validation for more information on how validators are run in forms, and Validating objects for how they’re run in models.
Reference Form fields
Upon form validation, these fields will place either one model object (in the case of ModelChoiceField) or multiple model objects (in the case of ModelMultipleChoiceField) into the cleaned_data dictionary of the form.
Reference Form fields
Upon form validation, these fields will place either one model object (in the case of ModelChoiceField) or multiple model objects (in the case of ModelMultipleChoiceField) into the cleaned_data dictionary of the form.
Reference Model field reference Field options
Note that this is different than null. null is purely database-related, whereas blank is validation-related. If a field has blank=True, form validation will allow entry of an empty value. If a field has blank=False, the field will be required.
Topic guide Using the Django authentication system
classLogoutView[source] : Logs a user out on POST requests.
Topic guide
Testing a web application is a complex task, because a web application is made of several layers of logic – from HTTP-level request handling, to form validation and processing, to template rendering.
Topic guide Using the Django authentication system Authentication in web requestsAuthentication Views
classLogoutView[source] : Logs a user out on POST requests.
Topic guide
Testing a web application is a complex task, because a web application is made of several layers of logic – from HTTP-level request handling, to form validation and processing, to template rendering.
Topic guide Models
Default is False. choices : A sequence of 2-value tuples, a mapping, an enumeration type, or a callable (that expects no arguments and returns any of the previous formats), to use as choices for this field.
Topic guide Models Fields
Default is False. choices : A sequence of 2-value tuples, a mapping, an enumeration type, or a callable (that expects no arguments and returns any of the previous formats), to use as choices for this field.
Release notes Django 1.2 release notes
Much of the validation work for ModelForms has been moved down to the model level. As a result, the first time you call ModelForm.is_valid(), access ModelForm.errors or otherwise trigger form validation, your model will be cleaned in-place.