On Feb 12, 5:35 pm, tow <[email protected]> wrote:
> class TextData(models.Model):
>      text = models.TextField(blank=True)
>
> obj = TextData()
> obj.text = None
> obj.save()
>
> gives me an IntegrityError. Why? I don't care that whether that's
> saved as a Null or an zero-length string, I just want Django to save
> back my data according to whatever convention it's using for this
> field - the docs tell me if I do blank=True, then it'll use an empty
> string and not bother distinguishing nulls; or at least so they imply
> to me. But apparently it is trying to distinguish nulls, because it's
> given me an IntegrityError. I was expecting Django to coerce the None
> to an empty string before saving.

The key to success here is using default="".
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to