#29051: unique_together behavior undocumented changes in 1.11
------------------------------------+--------------------------------------
     Reporter:  Christian Pedersen  |                    Owner:  nobody
         Type:  Bug                 |                   Status:  new
    Component:  Uncategorized       |                  Version:  1.11
     Severity:  Normal              |               Resolution:
     Keywords:                      |             Triage Stage:  Unreviewed
    Has patch:  0                   |      Needs documentation:  0
  Needs tests:  0                   |  Patch needs improvement:  0
Easy pickings:  0                   |                    UI/UX:  0
------------------------------------+--------------------------------------

Comment (by Tim Graham):

 I don't think the code you gave reproduces the issue. It works on all
 versions of Django that I tested. I imagine the correct steps to reproduce
 involve a model form.

 The release note for 1.11 says, "In model forms, `CharField` with
 `null=True` now saves `NULL` for blank values instead of empty strings."

 The documentation for
 
[https://docs.djangoproject.com/en/stable/ref/models/fields/#django.db.models.Field.null
 Field.null] says, "In most cases, it’s redundant to have two possible
 values for “no data;” the Django convention is to use the empty string,
 not NULL. One exception is when a `CharField` has both `unique=True` and
 `blank=True` set. In this situation, `null=True` is required to avoid
 unique constraint violations when saving multiple objects with blank
 values."

 The new behavior you mentioned seems to follow naturally if you understand
 what's happening (for the purposes of a unique constraint, PostgreSQL and
 other databases don't consider null values equal to each other). I'm not
 sure that a clarification of the release notes is required but do you want
 to propose one?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29051#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 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/066.52df6b54b78b2051702d1224518757af%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to