Hi
I have created a field in my model using the following:
class History(models.Model):date = models.DateTimeField(null=True)
then in the shell I have populated one row using the following
>>> History(date=datetime.now()).save()
I check the record is written in the DB which it is, I then do the following
>>> type(History.objects.get(id=1).date)
and get
>>> <type 'NoneType'>
but it is there in the DB and I can even sort by that field in a django queryset like so
History.objects.order_by('date')
and even though I cant get the date value when I look at the output I can tell from the records that it has been sorted correctly.
Thanks
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c0ac2264-de76-41e8-8b71-8681db7ec015%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment