#20581: Support DEFERRABLE INITIALLY DEFERRED for UNIQUE constraints
-------------------------------------+-------------------------------------
     Reporter:  dmadeley@…           |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:                       |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by koniiiik):

 My idea for an API was also to use something like `models.Unique(*fields,
 deferrable=True, initially_deferred=True)`, but not as a Model class
 attribute, but rather inside `unique_together`:

 {{{
 #!python
 class OrderedItem(models.Model):
     owner = ForeignKey('auth.User')
     order = PositiveIntegerField()
     data = TextField()

     class Meta:
         unique_together = (
             models.Unique('owner', 'order', deferrable=True),
         )
 }}}

 The idea is similar to urlpatterns – those also accept either a tuple, or
 the result of a `url` call. Also, it doesn't add a new API for this kind
 of constraints, merely extends the existing one.

--
Ticket URL: <https://code.djangoproject.com/ticket/20581#comment:4>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/085.257cd210c031651bb583aafc12172803%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to