Re: [Django] #4136: CharField(null=True, blank=True, unique=True)

2016-05-20 Thread Django
#4136: CharField(null=True, blank=True, unique=True)
-+-
 Reporter:  David Cramer |Owner:
  |
 Type:  Bug  |   Status:  new
Component:  Forms|  Version:  1.3-rc
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by claudep):

 * owner:  aashu_dwivedi =>
 * status:  assigned => new
 * needs_docs:  1 => 0
 * needs_tests:  1 => 0
 * needs_better_patch:  1 => 0


--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/090.d0611e0010bd592d4d00a09ce6b7da9c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #4136: CharField(null=True, blank=True, unique=True)

2015-04-29 Thread Django
#4136: CharField(null=True, blank=True, unique=True)
-+-
 Reporter:  David Cramer |Owner:
  |  aashu_dwivedi
 Type:  Bug  |   Status:  assigned
Component:  Forms|  Version:  1.3-rc
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  1
  Needs tests:  1|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-

Comment (by collinanderson):

 You probably have one entry that has an empty string instead of null.
 Change that to null/none and that should fix the uniqueness problem. If
 you use my code in your save method, you just need to call save on that
 object.

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/090.f970797a4b7b0ccb34e40c930cc77b65%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #4136: CharField(null=True, blank=True, unique=True)

2015-04-29 Thread Django
#4136: CharField(null=True, blank=True, unique=True)
-+-
 Reporter:  David Cramer |Owner:
  |  aashu_dwivedi
 Type:  Bug  |   Status:  assigned
Component:  Forms|  Version:  1.3-rc
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  1
  Needs tests:  1|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-

Comment (by anentropic):

 @collinanderson

 Can you elaborate?  Simply adding that to the model `save()` method alone
 seems to be insufficient because commonly we are using a `ModelForm` and
 that calls the instance's `validate_unique` method, which raises
 `ValidationError` before the `save` method is reached...

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/090.fd06eb35576b8c1610946f4544945959%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #4136: CharField(null=True, blank=True, unique=True) (was: NULL fields and Unique keys)

2015-01-26 Thread Django
#4136: CharField(null=True, blank=True, unique=True)
-+-
 Reporter:  David Cramer |Owner:
  |  aashu_dwivedi
 Type:  Bug  |   Status:  assigned
Component:  Forms|  Version:  1.3-rc
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  1
  Needs tests:  1|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by collinanderson):

 * cc: cmawebsite@… (added)


Comment:

 Seems to this actually applies to any fields that allow empty strings.
 It's either the form or the model's responsibility to automatically
 translate the blank strings into None in this case.

 I usually work around the problem by putting this in my model's `save()`
 method:

 `self.myfield = self.myfield or None`

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/090.d1ed2ceef147c6bf646ecb7adee755dd%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.