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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to