Skip to content
Browse files

[1.5.x] Documentation - Noted that OneToOneField doesn't respect unique.

Added OneToOneField to the list of model fields for which the unique
argument isn't valid. (OneToOneFields are inherently unique, and if
the user supplies a value for unique it is ignored / overwritten.)
  • Loading branch information...
1 parent adf7050 commit bbe2ad3e387a94de1898fb6bab17846b48e82f64 @marfire marfire committed with ptone
Showing with 2 additions and 2 deletions.
  1. +2 −2 docs/ref/models/fields.txt
4 docs/ref/models/fields.txt
@@ -269,8 +269,8 @@ you try to save a model with a duplicate value in a :attr:`~Field.unique`
field, a :exc:`django.db.IntegrityError` will be raised by the model's
:meth:`` method.
-This option is valid on all field types except :class:`ManyToManyField` and
+This option is valid on all field types except :class:`ManyToManyField`,
+:class:`OneToOneField`, and :class:`FileField`.
Note that when ``unique`` is ``True``, you don't need to specify
:attr:`~Field.db_index`, because ``unique`` implies the creation of an index.

0 comments on commit bbe2ad3

Please sign in to comment.
Something went wrong with that request. Please try again.