|null||If true, empty values may be stored as |
null in the database
|blank||If true, then the field will not be required in forms. If fields are left blank, Django will use the default field value.|
|choices||An iterable of 2-element iterables to be used as choices for this field. If set, field is rendered as a drop-down in the admin. |
[('m', 'Male'),('f','Female'),('z','Prefer Not to Disclose')]. To group options, simply nest the values:
[('Video Source',((1,'YouTube'),(2,'Facebook')),('Audio Source',((3, 'Soundcloud'),(4, 'Spotify'))]
|db_column||By default, django uses the field name for the database column. Use this to provide a custom name|
True, an index will be created on this field in the database
|db_tablespace||The tablespace to use for this field's index. This field is only used if the database engine supports it, otherwise its ignored.|
|default||The default value for this field. Can be a value, or a callable object. For mutable defaults (a list, a set, a dictionary) you must use a callable. Due to compatibility with migrations, you cannot use lambdas.|
False, the field is not shown in the model admin or any
ModelForm. Default is
|error_messages||Used to customize the default error messages shown for this field. The value is a dictionary, with the keys representing the error and the value being the message. Default keys (for error messages) are |
unique_for_date; additional error messages may be defined by custom fields.
|help_text||Text to be displayed with the field, to assist users. HTML is allowed.|
|on_delete||When an object referenced by a ForeignKey is deleted, Django will emulate the behavior of the SQL constraint specified by the on_delete argument. This is the second positional argument for both |
OneToOneField fields. Other fields do not have this argument.
True, this field will be the primary key. Django automatically adds a primary key; so this is only required if you wish to create a custom primary key. You can only have one primary key per model.
True, errors are raised if duplicate values are entered for this field. This is a database-level restriction, and not simply a user-interface block.
|unique_for_date||Set the value to a |
DateTimeField, and errors will be raised if there are duplicate values for the same date or date time.
|unique_for_month||Similar to |
unique_for_date, except checks are limited for the month.
|unique_for_year||Similar to |
unique_for_date, except checks are limited to the year.
|verbose_name||A friendly name for the field, used by django in various places (such as creating labels in the admin and model forms).|
|validators||A list of validators for this field.|