diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-04-24 12:58:49 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-04-25 07:36:07 +0200 |
| commit | 5df3301aab9e1d1c386799263bef5cf013985c83 (patch) | |
| tree | 78fb81120dba4b17f1fbf83a47f53e7f121fa4e4 /docs/ref | |
| parent | f8f0f92ed9f73a025de599bd1a4965f2cc2ebbba (diff) | |
Fixed #30362 -- Noted partial indexes and constraints restrictions with abstract base classes.
Thanks Carlton Gibson for the review.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/models/constraints.txt | 9 | ||||
| -rw-r--r-- | docs/ref/models/indexes.txt | 10 |
2 files changed, 19 insertions, 0 deletions
diff --git a/docs/ref/models/constraints.txt b/docs/ref/models/constraints.txt index 698b89ff54..77b9ea9c3c 100644 --- a/docs/ref/models/constraints.txt +++ b/docs/ref/models/constraints.txt @@ -19,6 +19,15 @@ option. convention is to use ``from django.db import models`` and refer to the constraints as ``models.<Foo>Constraint``. +.. admonition:: Constraints in abstract base classes + + You must always specify a unique name for the constraint. As such, you + cannot normally specify a constraint on an abstract base class, since the + :attr:`Meta.constraints <django.db.models.Options.constraints>` option is + inherited by subclasses, with exactly the same values for the attributes + (including ``name``) each time. Instead, specify the ``constraints`` option + on subclasses directly, providing a unique name for each constraint. + ``CheckConstraint`` =================== diff --git a/docs/ref/models/indexes.txt b/docs/ref/models/indexes.txt index b2a74e4bd7..14ccd8dc87 100644 --- a/docs/ref/models/indexes.txt +++ b/docs/ref/models/indexes.txt @@ -49,6 +49,16 @@ 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 an index. As such, you + cannot normally specify a partial index on an abstract base class, since + the :attr:`Meta.indexes <django.db.models.Options.indexes>` option is + inherited by subclasses, with exactly the same values for the attributes + (including ``name``) each time. Instead, specify the ``indexes`` option + on subclasses directly, providing a unique name for each index. + + ``db_tablespace`` ----------------- |
