Hi All,

Assuming this model:

class Month(models.Model):
     month = models.DateField(
         db_index=True,
         verbose_name='Month'
         )
     def __unicode__(self):
         return unicode(self.month.strftime('%B %Y'))

Now, I could have sworn this used to throw an error if I did:

m = Month()

...because I haven't supplied a required field. But it no longer seems 
to do so until .save() is called.

Am I imagining things?

This behaviour is suboptimal, here's an example why using the above model:

 >>> Month()
Traceback (most recent call last):
   File "models.py", line 65,
in __unicode__
     return unicode(self.month.strftime('%B %Y'))
AttributeError: 'NoneType' object has no attribute 'strftime'

:-(

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
            - http://www.simplistix.co.uk

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to