Field, required = True, whether to allow null widget = None, HTML plug label = None, or for generating a display content Label Label initial = None, initial value help_text = '', help information (shown next to the label) error_messages, = None, error message { 'required': 'not empty', 'invalid': 'malformed'} validators = [], custom validation rules localize = False, localized support disabled = False, whether edit label_suffix = None Label SUMMARY suffix as CharField (Field,) MAX_LENGTH = None, maximum length min_length = None, the minimum length of the strip = True whether to remove the user input blank IntegerField (Field) max_value = None, maximum min_value = None, minimum FloatField (IntegerField) ... DecimalField (IntegerField) max_value = None, maximum min_value = None, minimum max_digits = None, total length decimal_places = None, fractional bit length BaseTemporalField ( Field,) input_formats = None time format DateField (BaseTemporalField) format: 2015-09-01 TimeField (BaseTemporalField) format:. 11: 12 is DateTimeField (BaseTemporalField) format: 2015-09-01 11:12 DurationField (Field,) interval:% H% D:% M:% F% S. ... RegexField (as CharField) REGEX, custom regex MAX_LENGTH = None, maximum length min_length = None, minimum length error_message = None, ignore the error message used = {error_messages, 'invalid': '...'} EmailField (as CharField) ... the FileField (Field,) allow_empty_file = False whether to allow an empty file the ImageField (the FileField) ... Note: requires PIL module, pip3 install Pillow when two or more dictionaries used, two things should be noted: - form form = the enctype "multipart / form-Data" - View the MyForm = function obj (of request.POST, request.FILES) URLField (Field, ) ... BooleanField (Field,) ... NullBooleanField (BooleanField) ... ChoiceField (Field,) ... choices = (), options such as: choices = ((0, 'Shanghai'), (1, 'Beijing'),) required = True , required widget = None, plug-in, select the default plug- label = None, Label content initial = None, the initial value help_text = '', help tips ModelChoiceField (ChoiceField) ... django.forms.models.ModelChoiceField QuerySet, # query data in the database empty_label = "---------", # empty default display content to_field_name = None, # field value corresponding to the value of the HTML limit_choices_to = None # ModelForm in the secondary screening of queryset ModelMultipleChoiceField (for ModelChoiceField) ... django.forms.models.ModelMultipleChoiceField TypedChoiceField (ChoiceField) coerce the lambda = Val: Val for the selected conversion values empty_value = '' default null values MultipleChoiceField (ChoiceField) ... TypedMultipleChoiceField (MultipleChoiceField) coerce the lambda = Val: Val for each selected value conversion empty_value = 'Default value' null ComboField (Field,) Fields = () using a plurality of verification, as follows: i.e., the maximum length of 20 validation, verification and mailbox format fields.ComboField (Fields = [fields.CharField (MAX_LENGTH = 20), fields.EmailField (),]) MultiValueField (Field,) the PS: abstract subclass, aggregate multiple dictionaries can be implemented to match a value used to tie MultiWidget path, the folder path to match = None,Regular match SplitDateTimeField (MultiValueField) input_date_formats = None, list format: [ ' % Y -% m -% d ','% m% d /% Y ','% m /% d /% y '] input_time_formats = None list format: [ '% H:% M:% S', '% H:% M:% S. F%', '% H:% M'] that FilePathField will (ChoiceField) file option, directory file displayed in the page recursive = False, recursively following folder allow_files = True, allows files allow_folders = False, allowing the folder required = True, the widget = None, label = None, Initial = None, help_text = '' GenericIPAddressField Protocol = ' both ', both, ipv4, ipv6 support IP format unpack_ipv4 = False resolve ipv4 address, if it is :: ffff: 192.0.2.1 when resolves to 192.0.2.1, PS: protocol must be enabled in order to both SlugField (CharField) digital , letters, underscores, minus (hyphen) ... UUIDField (CharField) type uuid
Django form all the built-in fields
Guess you like
Origin www.cnblogs.com/cynic-y/p/11408991.html
Ranking