#32703: Deferred UniqueConstraints should not be validated in validate_unique()
-------------------------------------+-------------------------------------
Reporter: Manuel | Owner: nobody
Baclet |
Type: Bug | Status: new
Component: Database | Version: 3.1
layer (models, ORM) | Keywords: UniqueConstraint
Severity: Normal | deferrable
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
When using a deferred UniqueConstraint, we are expecting validation not to
occur before transaction commit.
Considering a model with a field `unique_valued_field` with a deferred
UniqueConstraint and two models `m1` and `m2`, we should be able to do:
{{{#!python
with transaction.atomic():
saved_value = m1.unique_valued_field
m1.unique_valued_field = m2.unique_valued_field
m2.unique_valued_field = saved_value
m1.save()
m2.save()
}}}
Currently, this raises a `ValidationError`.
--
Ticket URL: <https://code.djangoproject.com/ticket/32703>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/049.a30c89ff996e618f3805d35bdeda5cc0%40djangoproject.com.