On Thursday 01 Dec 2005 7:25 am, Joshua D. Drake wrote:
> >in django, if i want to insert a new record and just give a
> > value for the 'name' field and no values for the rest - it gets
> > saved. Postgresql should barf saying 'lack of value in xxx
> > field violates not null constraint' but it doesnt. This looks
> > very much like a serious bug to me
> >
>
> It should be noted that NULL != ''. If you say not null for a
> text field you can still
> enter a '' (blank string). That is perfectly valid. If you don't
> want null or blank you
> can say blank=False and null=False will give you the desired
> behavior.
this is my model:
class Visitor(meta.Model):
title = meta.CharField('Title',maxlength=250)
name = meta.CharField('Name',maxlength=100)
email = meta.EmailField('Email Id')
date = meta.DateField(auto_now_add=True)
matter = meta.TextField('Matter')
approved = meta.BooleanField('Approved',default='true')
i type this at the python prompt:
p = visitors.Visitor(title=l'title')
p.save()
it saves, pg doesnt barf, and i get '' values in all the text
fields. I feel the behaviour should be a barf from pg.
--
regards
kg
http://www.livejournal.com/users/lawgon
tally ho! http://avsap.org.in
ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!