From 8eae094638acf802c8047b341d126d94bc9b45a3 Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Sun, 5 Aug 2018 22:30:44 -0400 Subject: [PATCH] Generalized check constraint docs for other constraints. --- ...{check-constraints.txt => constraints.txt} | 19 +++++++++---------- docs/ref/models/index.txt | 2 +- docs/ref/models/options.txt | 4 ++-- docs/releases/2.2.txt | 4 ++-- 4 files changed, 14 insertions(+), 15 deletions(-) rename docs/ref/models/{check-constraints.txt => constraints.txt} (65%) diff --git a/docs/ref/models/check-constraints.txt b/docs/ref/models/constraints.txt similarity index 65% rename from docs/ref/models/check-constraints.txt rename to docs/ref/models/constraints.txt index 06ddd26b54..9e24a1cad8 100644 --- a/docs/ref/models/check-constraints.txt +++ b/docs/ref/models/constraints.txt @@ -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 -` 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 ` +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.Constraint``. -``CheckConstraint`` options -=========================== +``CheckConstraint`` +=================== .. class:: CheckConstraint(*, check, name) diff --git a/docs/ref/models/index.txt b/docs/ref/models/index.txt index c3aa5a718a..e48e138578 100644 --- a/docs/ref/models/index.txt +++ b/docs/ref/models/index.txt @@ -9,7 +9,7 @@ Model API reference. For introductory material, see :doc:`/topics/db/models`. fields indexes - check-constraints + constraints meta relations class diff --git a/docs/ref/models/options.txt b/docs/ref/models/options.txt index 6c098a8f56..4aedd4b92a 100644 --- a/docs/ref/models/options.txt +++ b/docs/ref/models/options.txt @@ -459,8 +459,8 @@ Django quotes column and table names behind the scenes. .. versionadded:: 2.2 - A list of :doc:`constraints ` that you want - to define on the model:: + A list of :doc:`constraints ` that you want to + define on the model:: from django.db import models diff --git a/docs/releases/2.2.txt b/docs/releases/2.2.txt index 6be7e3a544..ef68c31eab 100644 --- a/docs/releases/2.2.txt +++ b/docs/releases/2.2.txt @@ -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