'NoneType' object has no attribute 'day'

Posted by Asinox on Stack Overflow See other posts from Stack Overflow or by Asinox
Published on 2010-06-07T03:05:08Z Indexed on 2010/06/07 3:12 UTC
Read the original article Hit count: 411

Hi guy, i dont know where is my error, but Django 1.2.1 is give this error: 'NoneType' object has no attribute 'day' when i try to save form from the Administrator Area

models.py

from django.db import models
from django.contrib.auth.models import User


class Editorial(models.Model):

    titulo = models.CharField(max_length=250,help_text='Titulo del editorial')
    editorial = models.TextField(help_text='Editorial')
    slug = models.SlugField(unique_for_date='pub_date')
    autor = models.ForeignKey(User)
    pub_date = models.DateTimeField(auto_now_add=True)
    activa = models.BooleanField(verbose_name="Activa")
    enable_comments = models.BooleanField(verbose_name="Aceptar Comentarios",default=False)

    editorial_html = models.TextField(editable=False,blank=True)

    def __unicode__(self):
        return unicode(self.titulo)

    def get_absolute_url(self):
        return "/editorial/%s/%s/" % (self.pub_date.strftime("%Y/%b/%d").lower(), self.slug)

    class Meta:
        ordering=['-pub_date']   
        verbose_name_plural ='Editoriales'

    def save(self,force_insert=False, force_update=False):
        from markdown import markdown
        if self.editorial:
            self.editorial_html = markdown(self.editorial)
        super(Editorial,self).save(force_insert,force_update)

i dont know why this error,

thanks guys

sorry with my English

© Stack Overflow or respective owner

Related posts about django

Related posts about django-models