forms.Form.add_error()

Form.add_error(field, error) This method allows adding errors to specific fields from within the Form.clean() method, or from outside the form altogether; for instance from a view. The field argument is the name of the field to which the errors should be added. If its value is None the error will be treated as a non-field error as returned by Form.non_field_errors(). The error argument can be a simple string, or preferably an instance of ValidationError. See Raising ValidationError for best

forms.FilePathField.recursive

recursive If False (the default) only the direct contents of path will be offered as choices. If True, the directory will be descended into recursively and all descendants will be listed as choices.

forms.FilePathField.match

match A regular expression pattern; only files with names matching this expression will be allowed as choices.

forms.FilePathField.allow_folders

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

forms.FloatField

class FloatField(**kwargs) [source] Default widget: NumberInput when Field.localize is False, else TextInput. Empty value: None Normalizes to: A Python float. Validates that the given value is a float. Leading and trailing whitespace is allowed, as in Python’s float() function. Error message keys: required, invalid, max_value, min_value Takes two optional arguments for validation, max_value and min_value. These control the range of values permitted in the field.

forms.FilePathField.path

path The absolute path to the directory whose contents you want listed. This directory must exist.

forms.FilePathField

class FilePathField(**kwargs) [source] Default widget: Select Empty value: None Normalizes to: A unicode object Validates that the selected choice exists in the list of choices. Error message keys: required, invalid_choice The field allows choosing from files inside a certain directory. It takes five extra arguments; only path is required: path The absolute path to the directory whose contents you want listed. This directory must exist. recursive If False (the default) only the

forms.FileInput

class FileInput [source] File upload input: <input type='file' ...>

forms.FileField

class FileField(**kwargs) [source] Default widget: ClearableFileInput Empty value: None Normalizes to: An UploadedFile object that wraps the file content and file name into a single object. Can validate that non-empty file data has been bound to the form. Error message keys: required, invalid, missing, empty, max_length Has two optional arguments for validation, max_length and allow_empty_file. If provided, these ensure that the file name is at most the given length, and that validation

forms.Field.widget

Field.widget The widget argument lets you specify a Widget class to use when rendering this Field. See Widgets for more information.