Re: blank=True on Char/TextFields

2009-04-07 Thread Malcolm Tredinnick
On Tue, 2009-04-07 at 10:26 -0700, Magus wrote: > I agree with Lee. There should be a way for a developer to store NULL > into a char field. At the moment null flag has no effect for a > CharField. Generally saying an empty string is not the same a not > defined value = NULL. It's pity that the ac

Re: blank=True on Char/TextFields

2009-04-07 Thread julianb
On Feb 12, 5:35 pm, tow 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 sav

Re: blank=True on Char/TextFields

2009-04-07 Thread Magus
I agree with Lee. There should be a way for a developer to store NULL into a char field. At the moment null flag has no effect for a CharField. Generally saying an empty string is not the same a not defined value = NULL. It's pity that the according ticket is closed with won't fix http://code.djan

Re: blank=True on Char/TextFields

2009-02-13 Thread tow
I'm sure it's possible that I haven't read the django docs properly; but I think my problem is actually that the Django docs don't speak to my usecase. I don't care how the database stores empty values. Really, nothing is of less interest to me, I find the details of database schemata extremely b

Re: blank=True on Char/TextFields

2009-02-13 Thread James Bennett
On Fri, Feb 13, 2009 at 6:31 AM, Lee Braiden wrote: > What exactly is the reasoning behind this advice? It seems to me that > one would very rarely want to store an empty string. For example, if > a user doesn't enter a surname, that does not mean that their surname > is "", unless they're Cher

Re: blank=True on Char/TextFields

2009-02-13 Thread Lee Braiden
2009/2/13 Praveen : > Avoid using null on string-based fields such as CharField and > TextField unless you have an excellent reason. What exactly is the reasoning behind this advice? It seems to me that one would very rarely want to store an empty string. For example, if a user doesn't enter a

Re: blank=True on Char/TextFields

2009-02-13 Thread Praveen
Hi Toby, you have not read properly the django docs. Note that empty string values will always get stored as empty strings, not as NULL. only use null=True for non-string fields such as integers, booleans and dates. For both types of fields, you will also need to set blank=True if you wish to p