#32703: Deferred UniqueConstraints should not be validated in validate_unique()
-------------------------------------+-------------------------------------
     Reporter:  Manuel Baclet        |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  3.1
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  UniqueConstraint     |             Triage Stage:
  deferrable                         |  Unreviewed
    Has patch:  0                    |      Needs documentation:  1
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Manuel Baclet:

Old description:

> 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`.

New description:

 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 instances `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#comment:3>
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/064.0977cd805e628ae063278b4ee5ff4d45%40djangoproject.com.

Reply via email to