DateField always return None value
Question: 
    class News(models.Model):
      title = models.CharField(max_length=70)
      full_text = models.TextField()
      pub_date = models.DateField('-pub_date')
    

then i run python manage.py shell whatever i do value for News.pub_date is
None

i am using sqlite3 and when i open database i could see that date values are
there. but when i recover an object pub_date is None. I dont reveive any error
after s=News.objects.all()[0].pub_date enter code here

    
    
    >>> from face.models import News
    >>> from datetime import datetime
    >>> s=News()
    >>> s.pub_date
    
    >>> s=News()
    >>> s.title="hgello"
    >>> s.full_text="hello there"
    >>> s.pub_date = datetime.now()
    >>> s.show=True
    >>> s.save()
    >>> t=News.objects.all()
    >>> t
    [<News: This is title>, <News: second text>, <News: sample>, <News: hgello>]
    >>> t=t[3]
    >>> print t.pub_date
        None
    

*_I have solved the issue. i just deleted database file of sqllite3. I think it happened becouse initially it was named DateTimeField and then I changed it to DateField. But i did syncdb in between of changes. So django was able successfully store date data but cannot recover. And re-syncdb didnt help i did it several times. only phisycal delete of database and recreation structure of database solved the usue. *_


Answer: You probably wanted to set the [`auto_now_add`
parameter](https://docs.djangoproject.com/en/1.4/ref/models/fields/#django.db.models.DateField):

    
    
    pub_date = models.DateField(auto_now_add=True)
    

Alternatively, you could override the `.save()` method:

    
    
    class News(models.Model):
        title = models.CharField(max_length=70)
        full_text = models.TextField()
        pub_date = models.DateField()
    
        def save(self, *args, **kwargs):
            if not self.id:
                self.pub_date = datetime.datetime.today()
            super(News, self).save(*args, **kwargs)
    

