Cannot assign None, does not allow null values

Skip to first unread message


Nov 27, 2009, 4:57:13 PM11/27/09
to Django users
i get this error when i try to create new item in admin site.

here is my
import datetime
from django.db import models
from tinymce import models as tinymce_models
from filebrowser.fields import FileBrowseField

class ItemWithMedia(models.Model):
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)

class Actual(ItemWithMedia):
published = models.DateField('Published')
title_hr = models.CharField('(hr)', max_length=200)
title_en = models.CharField('(en)', max_length=200)
body_text_hr = models.TextField('(hr)')
body_text_en = models.TextField('(en)')

def __unicode__(self):
return self.title_hr

class Meta:
verbose_name = "Aktualno"
verbose_name_plural = "Aktualni"
ordering = ['-published']

what could be the problem?


Nov 27, 2009, 5:27:24 PM11/27/09
to Django users
btw. here is a full code:

so... when i go to create new Actual item i get this error:
Cannot assign None: "Actual.published" does not allow null values.

Tim Valenta

Nov 27, 2009, 9:32:28 PM11/27/09
to Django users
You've got a lot of models in that file. Which one are you trying to
save when it throws the error?

By the way, I notice that your "ItemWithMedia" class is probably
creating a database table.. if you never need to manipulate it direct
(ie, you only make subclasses of it), I might suggest putting this in
the definition:

class ItemWithMedia(models.Model):
# ... all of your old stuff goes here
class Meta:
abstract = True

That way Django knows it's just a base class.

Not sure what the problem is, yet...

On Nov 27, 3:27 pm, onoxo <> wrote:
> btw. here is a full code:
> models.py
> admin.py


Nov 28, 2009, 3:07:43 AM11/28/09
to Django users

when i go to create Actual class. i get this error:
Cannot assign None: "Actual.published" does not allow null values.

and it makes this error with each class that has published propertie.

Martin Lundberg

Nov 28, 2009, 5:20:29 AM11/28/09
Is it not that you forget to give the published property a value?


You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply all
Reply to author
0 new messages