Meaning of parameters and models django table

. 1 , since the additional models.AutoField = int ( . 11 )
  If not, the default will generate a name for the id column, Custom If you want to display a custom add, you must give column as the primary key primary_key = True.
2 , string field models.CharField
  Parameters must max_length
. 3 , models.BooleanField boolean tinyint = ( . 1 )
  Can not be empty, Blank = True
 . 4 , numbers separated by commas models.ComaSeparatedIntegerField = VARCHAR
  Inheritance CharField, parameters must max_lenght
5 , models.DateField date type date
  For the parameters, auto_now = True then each update will update this time; auto_now_add then just add first created, no longer change after the update.
6 , models.DateTimeField date type datetime
  With DateField parameters
. 7 , models.Decimal decimal type = decimal
  You must specify decimal integer bits max_digits and decimal_places
. 8 , models.EmailField string type (regular expressions mailbox) = VARCHAR
  The string regular expression
. 9 , models.FloatField float type = Double 
10 , models.IntegerField shaping
 . 11 , long integer models.BigIntegerField
  integer_field_ranges = {
     'SmallIntegerField' :( - 32768 , 32767 ),
     'IntegerField' :( - 2147483648 , 2147483647 ),
     'BigIntegerField' :( - 9223372036854775808 , 9223372036854775807 ),
     'PositiveSmallIntegerField' :( 0 , 32767 ),
     'PositiveIntegerField' :( 0 , 2147483647 ),
  }
12 is , models.IPAddressField string type (IP4 regular expressions)
 13 is , models.GenericIPAddressField string type (IP4 and ip6 is optional)
  Parameter protocol can be: both, ipv4, ipv6
  Verification, based on the setting error
14 , models.NullBooleanField allow boolean empty
 15 , models.PositiveIntegerFiel positive Integer
 16 , models.PositiveSmallIntegerField n smallInteger
 . 17 , models.SlugField minus sign, underscore, letters, numbers
 18 is , digital models.SmallIntegerField
  There are fields in the database: tinyint, smallint The, int , BIGINT
 . 19 , models.TextField string = LONGTEXT
 20 is , models.TimeField Time HH: the MM [: SS [.uuuuuu]]
 21 is , models.URLField string, the regular expression address type
 22 , models.BinaryField binary
 23 , models.ImageField picture
 24- , models.FilePathField file

Some fields of meaning

1null = True
  Whether the database field can be empty
2 、blank = True
  Whether null data is added to allow the Admin in django
3 、primary_key = False
  Primary keys, of the primary key AutoField provided, it will replace the original self-energizing id column
4 、auto_now 和 auto_now_add
  auto_now created automatically - - - Whether added or modified, it is currently operating time
  auto_now_add created automatically - - - always the time it was created
 5 , choices
GENDER_CHOICE = (
(the ' M ' , the ' Male ' ),
(u 'F' , u 'Female' ),
)
Gender = models.CharField (MAX_LENGTH = 2 , choices = GENDER_CHOICE)
 . 6 , MAX_LENGTH
 . 7 , default   Default
 8 , the name of a field in verbose_name Admin
 . 9 , name | field name db_column database
 10 , UNIQUE = True allowed to repeat
 11 , db_index = True database index
 12 , editable = are True Admin can edit in
 13 , error_messages = None error
 14 , auto_created = False automatically create
 15 , help_text help information in Admin,
 16 , validators = []
 17 、upload - to

 

Guess you like

Origin www.cnblogs.com/daicw/p/12018098.html