forms.Field.error_messages

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. For example, here is the default error message: >>> from django import forms >>> generic = forms.CharField() >>> generic.clean('') Traceback (most recent call last): ... ValidationError: ['This field is required.'] And here is a custom error message: >>> name =

forms.Field.disabled

Field.disabled New in Django 1.9. The disabled boolean argument, when set to True, disables a form field using the disabled HTML attribute so that it won’t be editable by users. Even if a user tampers with the field’s value submitted to the server, it will be ignored in favor of the value from the form’s initial data.

forms.Field.clean()

Field.clean(value) [source] Although the primary way you’ll use Field classes is in Form classes, you can also instantiate them and use them directly to get a better idea of how they work. Each Field instance has a clean() method, which takes a single argument and either raises a django.forms.ValidationError exception or returns the clean value: >>> from django import forms >>> f = forms.EmailField() >>> f.clean('foo@example.com') 'foo@example.com' >>> f.c

forms.Field

class Field(**kwargs) [source] When you create a Form class, the most important part is defining the fields of the form. Each field has custom validation logic, along with a few other hooks.

forms.EmailInput

class EmailInput [source] Text input: <input type="email" ...>

forms.EmailField

class EmailField(**kwargs) [source] Default widget: EmailInput Empty value: '' (an empty string) Normalizes to: A Unicode object. Validates that the given value is a valid email address, using a moderately complex regular expression. Error message keys: required, invalid Has two optional arguments for validation, max_length and min_length. If provided, these arguments ensure that the string is at most or at least the given length.

forms.DurationField

class DurationField(**kwargs) [source] Default widget: TextInput Empty value: None Normalizes to: A Python timedelta. Validates that the given value is a string which can be converted into a timedelta. Error message keys: required, invalid. Accepts any format understood by parse_duration().

forms.DecimalField.min_value

min_value These control the range of values permitted in the field, and should be given as decimal.Decimal values.

forms.DecimalField.max_value

max_value

forms.DecimalField.max_digits

max_digits The maximum number of digits (those before the decimal point plus those after the decimal point, with leading zeros stripped) permitted in the value.