However, for the soon to be deprecated `unique_together`, there is a
reference to model validation.
As far as I can see, a `UniqueConstraint` causes `validate_unique()` to
check for uniqueness and raises a **ValidationError**. But a
`CheckConstraint` does not cause a **ValidationError** when the model is
validated. I believe it's important to mention this in the documentation.
--
Ticket URL: <https://code.djangoproject.com/ticket/30547>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Unreviewed => Accepted
* easy: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/30547#comment:1>
* owner: nobody => Swatantra
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/30547#comment:2>
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/11478 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/30547#comment:3>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/30547#comment:4>
* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/30547#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"00169bc36156d4a32546229bf39de91213709eaf" 00169bc3]:
{{{
#!CommitTicketReference repository=""
revision="00169bc36156d4a32546229bf39de91213709eaf"
Fixed #30547 -- Doc'd how Meta.constraints affect model validation.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30547#comment:6>
Comment (by Carlton Gibson <carlton.gibson@…>):
In [changeset:"c3a0f76d11f8cb282798770152c875ba49445481" c3a0f76d]:
{{{
#!CommitTicketReference repository=""
revision="c3a0f76d11f8cb282798770152c875ba49445481"
[2.2.x] Fixed #30547 -- Doc'd how Meta.constraints affect model
validation.
Backport of 00169bc36156d4a32546229bf39de91213709eaf from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30547#comment:7>
* cc: Kevin Christopher Henry (added)
Comment:
I suggest that the note be expanded to indicate that uniqueness validation
does ''not'' work if the `condition` parameter is used (i.e. for partial
unique indexes). Based on
[https://github.com/django/django/pull/10796#discussion_r244216763 this
comment] it appears to be a hard problem, and unlikely to be implemented
any time soon.
--
Ticket URL: <https://code.djangoproject.com/ticket/30547#comment:8>
Comment (by felixxm):
Good catch! I added clarification in
[https://github.com/django/django/pull/11574 PR].
--
Ticket URL: <https://code.djangoproject.com/ticket/30547#comment:9>
Comment (by GitHub <noreply@…>):
In [changeset:"230d75f59c43b9731465c4ec92ad714e301637b8" 230d75f5]:
{{{
#!CommitTicketReference repository=""
revision="230d75f59c43b9731465c4ec92ad714e301637b8"
Refs #30547 -- Clarified that partial UniqueConstraints don't affect model
validation.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30547#comment:10>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"0088e592922e2a711815cdb90a2610a1f1704a9a" 0088e592]:
{{{
#!CommitTicketReference repository=""
revision="0088e592922e2a711815cdb90a2610a1f1704a9a"
[2.2.x] Refs #30547 -- Clarified that partial UniqueConstraints don't
affect model validation.
Backport of 230d75f59c43b9731465c4ec92ad714e301637b8 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30547#comment:11>