1
0
mirror of https://github.com/django/django.git synced 2025-06-05 03:29:12 +00:00

[2.2.x] Fixed UniqueConstraint example in ref/models/constraints.txt.

Backport of f8f0f92ed9f73a025de599bd1a4965f2cc2ebbba from master
This commit is contained in:
Mariusz Felisiak 2019-04-24 12:58:35 +02:00
parent 46416554f3
commit 158cfebe87

View File

@ -78,7 +78,10 @@ The name of the constraint.
A :class:`Q` object that specifies the condition you want the constraint to A :class:`Q` object that specifies the condition you want the constraint to
enforce. enforce.
For example, ``UniqueConstraint(fields=['user'], condition=Q(status='DRAFT')`` For example::
UniqueConstraint(fields=['user'], condition=Q(status='DRAFT'), name='unique_draft_user')
ensures that each user only has one draft. ensures that each user only has one draft.
These conditions have the same database restrictions as These conditions have the same database restrictions as