Did you perhaps change the schema of the database after you had created it.
Eg: added null=True as a constraint after creating the table? If so check the db sheme using: python manage.py sqlall <appname> It sounds simple enough. You will have to go into the db shell and update your schema manually. using python manage.py dbshell If you're developing something where the schema is always getting modified and you dont want to manually update table constraints look into django south addon. hope this helps On Wed, Mar 26, 2014 at 3:31 PM, Sami Razi <[email protected]> wrote: > > i'm learning django using djangobook <http://djangobook.com>, in chapter > 6, i'm having this error: > > IntegrityError at /admin/books/book/add/ > > NOT NULL constraint failed: books_book.publication_date > > > it seems i should set null=True for publication_date field. but i did it > already, this is my models.py: > > > from django.db import models > > class Publisher(models.Model): > name = models.CharField(max_length=30) > address = models.CharField(max_length=50) > city = models.CharField(max_length=60) > state_province = models.CharField(max_length=30) > country = models.CharField(max_length=50) > website = models.URLField() > > def __unicode__(self): > return self.name > > class Author(models.Model): > first_name = models.CharField(max_length=30) > last_name = models.CharField(max_length=40) > email = models.EmailField(blank=True, verbose_name='e-mail') > > def __unicode__(self): > return u'%s %s' % (self.first_name, self.last_name) > > class Book(models.Model): > title = models.CharField(max_length=100) > authors = models.ManyToManyField(Author) > publisher = models.ForeignKey(Publisher) > publication_date = models.DateField(blank=True, *null=True*) > > def __unicode__(self): > return self.title > > > what am i doing wrong? > i googled the error message but didn't find a related answer. > thank you for your help. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" 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]. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/87ef0e56-f90f-4097-8a2c-e747ac874b71%40googlegroups.com<https://groups.google.com/d/msgid/django-users/87ef0e56-f90f-4097-8a2c-e747ac874b71%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" 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]. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMbLS2-4SLs_OqCrKj4qQm_Xif2oDsCG97RJWDmrAFUR%2BCuxNA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

