id = models. Integerfield (Primary_key = True)
Report:
- Null: The default setting is False. It is not normally used on character fields, such as Charfield,textfield. Character fields If no value returns an empty string.
- Blank: Whether the field can be empty. If False, you must have a value
- Choices: A 2-dimensional tuple that is used to select values. The first value is the actual stored value, and the second is used to make the selection easier. such as sex_choices= (' F ', ' Female '), (' M ', ' Male '),)
- Core:db_column,db_index if the index is true for this field
- Default: Set default value
- Editable: If False, admin mode will not overwrite. Default is True
- Help Documents in Help_text:admin mode
- Primary_key: Sets the primary key, which is automatically added if the Django creation table is not set:
id = meta. Autofield ('ID', primary_key=True) primary_key and is allowed On a object.
- Radio_admin: Used in admin mode to convert Select to radio display. Only for ForeignKey or set choices
- Unique: Data Unique
- Unique_for_date: The date is unique, in the following example, the system will not allow the title and pub_date two identical data to recur
- title = Meta. Charfield (maxlength=30,unique_for_date= ' pub_date ')
- Unique_for_month/unique_for_year: Usage Ibid.
- Validator_list: Validity check. Non-efficient generation of django.core.validators.ValidationError errors
How the Django database sets the primary key for a field