Field.unique
If True
, this field must be unique throughout the table.
This is enforced at the database level and by model validation. If you try to save a model with a duplicate value in a unique
field, a django.db.IntegrityError
will be raised by the model’s save()
method.
This option is valid on all field types except ManyToManyField
, OneToOneField
, and FileField
.
Note that when unique
is True
, you don’t need to specify db_index
, because unique
implies the creation of an index.
Please login to continue.