class ModelChoiceField(**kwargs) [source] Default widget: Select Empty value: None Normalizes to: A model instance. Validates that the given id exists in the queryset. Error message keys: required, invalid_choice Allows the selection of a single model object, suitable for representing a foreign key. Note that the default widget for ModelChoiceField becomes impractical when the number of entries increases. You should avoid using it for more than 100 items. A single argument is required:
min_value These control the range of values permitted in the field.
max_value
class IntegerField(**kwargs) [source] Default widget: NumberInput when Field.localize is False, else TextInput. Empty value: None Normalizes to: A Python integer or long integer. Validates that the given value is an integer. Leading and trailing whitespace is allowed, as in Python’s int() function. Error message keys: required, invalid, max_value, min_value The max_value and min_value error messages may contain %(limit_value)s, which will be substituted by the appropriate limit. Takes tw
class ImageField(**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. Validates that file data has been bound to the form, and that the file is of an image format understood by Pillow. Error message keys: required, invalid, missing, empty, invalid_image Using an ImageField requires that Pillow is installed with support for the image formats you use. If you encounter a
class HiddenInput [source] Hidden input: <input type='hidden' ...> Note that there also is a MultipleHiddenInput widget that encapsulates a set of hidden input elements.
unpack_ipv4 Unpacks IPv4 mapped addresses like ::ffff:192.0.2.1. If this option is enabled that address would be unpacked to 192.0.2.1. Default is disabled. Can only be used when protocol is set to 'both'.
protocol Limits valid inputs to the specified protocol. Accepted values are both (default), IPv4 or IPv6. Matching is case insensitive.
class GenericIPAddressField(**kwargs) [source] A field containing either an IPv4 or an IPv6 address. Default widget: TextInput Empty value: '' (an empty string) Normalizes to: A Unicode object. IPv6 addresses are normalized as described below. Validates that the given value is a valid IP address. Error message keys: required, invalid The IPv6 address normalization follows RFC 4291#section-2.2 section 2.2, including using the IPv4 format suggested in paragraph 3 of that section, like ::ff
formset_factory(form, formset=BaseFormSet, extra=1, can_order=False, can_delete=False, max_num=None, validate_max=False, min_num=None, validate_min=False) [source] Returns a FormSet class for the given form class. See formsets for example usage.
Page 130 of 226