Generalized check constraint docs for other constraints.

This commit is contained in:
Simon Charette 2018-08-05 22:30:44 -04:00 committed by Tim Graham
parent d0af5de122
commit 8eae094638
4 changed files with 14 additions and 15 deletions

View File

@ -1,6 +1,6 @@
===========================
Check constraints reference
===========================
=====================
Constraints reference
=====================
.. module:: django.db.models.constraints
@ -8,20 +8,19 @@ Check constraints reference
.. versionadded:: 2.2
The ``CheckConstraint`` class creates database check constraints. They are
added in the model :attr:`Meta.constraints
<django.db.models.Options.constraints>` option. This document
explains the API references of :class:`CheckConstraint`.
The classes defined in this module create database constraints. They are added
in the model :attr:`Meta.constraints <django.db.models.Options.constraints>`
option.
.. admonition:: Referencing built-in constraints
Constraints are defined in ``django.db.models.constraints``, but for
convenience they're imported into :mod:`django.db.models`. The standard
convention is to use ``from django.db import models`` and refer to the
constraints as ``models.CheckConstraint``.
constraints as ``models.<Foo>Constraint``.
``CheckConstraint`` options
===========================
``CheckConstraint``
===================
.. class:: CheckConstraint(*, check, name)

View File

@ -9,7 +9,7 @@ Model API reference. For introductory material, see :doc:`/topics/db/models`.
fields
indexes
check-constraints
constraints
meta
relations
class

View File

@ -459,8 +459,8 @@ Django quotes column and table names behind the scenes.
.. versionadded:: 2.2
A list of :doc:`constraints </ref/models/check-constraints>` that you want
to define on the model::
A list of :doc:`constraints </ref/models/constraints>` that you want to
define on the model::
from django.db import models

View File

@ -30,8 +30,8 @@ officially support the latest release of each series.
What's new in Django 2.2
========================
Check Constraints
-----------------
Constraints
-----------
The new :class:`~django.db.models.CheckConstraint` class enables adding custom
database constraints. Constraints are added to models using the