forms.FilePathField.allow_files

allow_files Optional. Either True or False. Default is True. Specifies whether files in the specified location should be included. Either this or allow_folders must be True.

forms.Field.label_suffix

Field.label_suffix The label_suffix argument lets you override the form’s label_suffix on a per-field basis: >>> class ContactForm(forms.Form): ... age = forms.IntegerField() ... nationality = forms.CharField() ... captcha_answer = forms.IntegerField(label='2 + 2', label_suffix=' =') >>> f = ContactForm(label_suffix='?') >>> print(f.as_p()) <p><label for="id_age">Age?</label> <input id="id_age" name="age" type="number" required />

forms.Field.validators

Field.validators The validators argument lets you provide a list of validation functions for this field. See the validators documentation for more information.

forms.Field.required

Field.required By default, each Field class assumes the value is required, so if you pass an empty value – either None or the empty string ("") – then clean() will raise a ValidationError exception: >>> from django import forms >>> f = forms.CharField() >>> f.clean('foo') 'foo' >>> f.clean('') Traceback (most recent call last): ... ValidationError: ['This field is required.'] >>> f.clean(None) Traceback (most recent call last): ... ValidationError

forms.Field.localize

Field.localize The localize argument enables the localization of form data input, as well as the rendered output. See the format localization documentation for more information.

forms.Field.help_text

Field.help_text The help_text argument lets you specify descriptive text for this Field. If you provide help_text, it will be displayed next to the Field when the Field is rendered by one of the convenience Form methods (e.g., as_ul()). Like the model field’s help_text, this value isn’t HTML-escaped in automatically-generated forms. Here’s a full example Form that implements help_text for two of its fields. We’ve specified auto_id=False to simplify the output: >>> from django import

forms.Field.label

Field.label The label argument lets you specify the “human-friendly” label for this field. This is used when the Field is displayed in a Form. As explained in “Outputting forms as HTML” above, the default label for a Field is generated from the field name by converting all underscores to spaces and upper-casing the first letter. Specify label if that default behavior doesn’t result in an adequate label. Here’s a full example Form that implements label for two of its fields. We’ve specified a

forms.Field.has_changed()

Field.has_changed() [source] The has_changed() method is used to determine if the field value has changed from the initial value. Returns True or False. See the Form.has_changed() documentation for more information.

forms.Field.initial

Field.initial The initial argument lets you specify the initial value to use when rendering this Field in an unbound Form. To specify dynamic initial data, see the Form.initial parameter. The use-case for this is when you want to display an “empty” form in which a field is initialized to a particular value. For example: >>> from django import forms >>> class CommentForm(forms.Form): ... name = forms.CharField(initial='Your name') ... url = forms.URLField(initial='ht

forms.Field.get_bound_field()

Field.get_bound_field(form, field_name) [source] Takes an instance of Form and the name of the field. The return value will be used when accessing the field in a template. Most likely it will be an instance of a subclass of BoundField. If you have a GPSCoordinatesField, for example, and want to be able to access additional information about the coordinates in a template, this could be implemented as follows: class GPSCoordinatesBoundField(BoundField): @property def country(self):