diff --git a/docs/ref/models/constraints.txt b/docs/ref/models/constraints.txt index 698b89ff54023..69d8f16c8e5f6 100644 --- a/docs/ref/models/constraints.txt +++ b/docs/ref/models/constraints.txt @@ -19,6 +19,16 @@ option. convention is to use ``from django.db import models`` and refer to the constraints as ``models.Constraint``. +.. admonition:: Constraints in abstract base classes + + You must always specify a unique name for the constraint. This would + normally cause a problem in abstract base classes, since the + :attr:`Meta.constraints ` option on + this class are included into each of the child classes, with exactly the + same values for the attributes (including ``name``) each time. To work + around this problem, ``constraints`` option should be specified for each of + the child classes with unique names for constraints. + ``CheckConstraint`` =================== diff --git a/docs/ref/models/indexes.txt b/docs/ref/models/indexes.txt index b2a74e4bd75e8..9ff568e0be4ce 100644 --- a/docs/ref/models/indexes.txt +++ b/docs/ref/models/indexes.txt @@ -49,6 +49,17 @@ The name of the index. If ``name`` isn't provided Django will auto-generate a name. For compatibility with different databases, index names cannot be longer than 30 characters and shouldn't start with a number (0-9) or underscore (_). +.. admonition:: Partial indexes in abstract base classes + + You must always specify a unique name for the index. This would normally + cause a problem for partial indexes in abstract base classes, since + ``name`` is required and the + :attr:`Meta.indexes ` option on this + class are included into each of the child classes, with exactly the same + values for the attributes (including ``name``) each time. To work around + this problem, ``indexes`` option should be specified for each of the child + classes with unique names for indexes. + ``db_tablespace`` -----------------