#34311: Update serialization examples from unique_together to UniqueConstraint
-------------------------------------+-------------------------------------
     Reporter:  Willem Van Onsem     |                    Owner:  Willem
         Type:                       |  Van Onsem
  Cleanup/optimization               |                   Status:  assigned
    Component:  Documentation        |                  Version:  4.1
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Willem Van Onsem):

 Replying to [comment:4 Waqar ALi]:
 No, Django had in the early days `unique_together`, now it still has, but
 as the note on the documentation says
 
(https://docs.djangoproject.com/en/4.1/ref/models/options/#django.db.models.Options.unique_together):

 > Use `UniqueConstraint` with the constraints option instead.

 It "translated" to a unique constraint. But it was less flexible since one
 could not give it a custom name, add a condition, make it a functional
 unique constraint, etc. So `UniqueConstraint` is the "new way" to define
 this, whereas `unique_together` is the "old" way to generate such database
 constraint.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34311#comment:5>
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/01070186230800ff-ac7fceed-04ea-4ff4-a158-995142e37c6c-000000%40eu-central-1.amazonses.com.

Reply via email to