diff options
| author | Gagaro <gagaro42@gmail.com> | 2022-03-16 16:05:12 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-03-16 16:55:17 +0100 |
| commit | 9c04af837a333caa3e06a72ae53f77c064c94c3e (patch) | |
| tree | 67a4d186ec1d6a62c700db0543926870c98e26a8 /docs | |
| parent | 4bd494db42cbe7ab8dc212dd5986ba3532488138 (diff) | |
Doc'd BaseConstraint.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/contrib/postgres/constraints.txt | 2 | ||||
| -rw-r--r-- | docs/ref/models/constraints.txt | 34 |
2 files changed, 19 insertions, 17 deletions
diff --git a/docs/ref/contrib/postgres/constraints.txt b/docs/ref/contrib/postgres/constraints.txt index 1ea1fcfb8f..1c283c367e 100644 --- a/docs/ref/contrib/postgres/constraints.txt +++ b/docs/ref/contrib/postgres/constraints.txt @@ -32,7 +32,7 @@ PostgreSQL supports additional data integrity constraints available from the .. attribute:: ExclusionConstraint.name -The name of the constraint. +See :attr:`.BaseConstraint.name`. ``expressions`` --------------- diff --git a/docs/ref/models/constraints.txt b/docs/ref/models/constraints.txt index 17d5c3362b..52bb8b48e0 100644 --- a/docs/ref/models/constraints.txt +++ b/docs/ref/models/constraints.txt @@ -42,6 +42,24 @@ option. also raised during model validation when the ``UniqueConstraint`` is violated. +``BaseConstraint`` +================== + +.. class:: BaseConstraint(name) + + Base class for all constraints. Subclasses must implement + ``constraint_sql()``, ``create_sql()``, and ``remove_sql()`` methods. + +All constraints have the following parameters in common: + +``name`` +-------- + +.. attribute:: BaseConstraint.name + +The name of the constraint. You must always specify a unique name for the +constraint. + ``CheckConstraint`` =================== @@ -60,14 +78,6 @@ specifies the check you want the constraint to enforce. For example, ``CheckConstraint(check=Q(age__gte=18), name='age_gte_18')`` ensures the age field is never less than 18. -``name`` --------- - -.. attribute:: CheckConstraint.name - -The name of the constraint. You must always specify a unique name for the -constraint. - ``UniqueConstraint`` ==================== @@ -107,14 +117,6 @@ For example, ``UniqueConstraint(fields=['room', 'date'], name='unique_booking')`` ensures each room can only be booked once for each date. -``name`` --------- - -.. attribute:: UniqueConstraint.name - -The name of the constraint. You must always specify a unique name for the -constraint. - ``condition`` ------------- |
