Take a look at
https://docs.djangoproject.com/en/dev/topics/i18n/timezones/#naive-and-aware-datetime-objects
Basically you need to fix datetime objects adding a timezone.https://docs.djangoproject.com/en/dev/topics/i18n/timezones/#naive-and-aware-datetime-objects
Leonardo Giordani
Author of The Digital CatMy profile on About.me - My GitHub page - My Coderwall profile
2013/11/4 NHT <nasirakram33@gmail.com>
In poll app, I set Time_Zone='Asia/Kolkata' and USE_TZ=True in settings.py file.--In models.py file,import datetimefrom django.utils import timezonefrom django.db import modelsclass Poll(models.Model):question = models.CharField(max_length=200)pub_date = models.DateTimeField('date published')def __unicode__(self):return self.questiondef was_published_recently(self):return self.pub_date >= timezone.now() - datetime.timedelta(days=1)class Choice(models.Model):poll = models.ForeignKey(Poll)choice_text = models.CharField(max_length=200)votes = models.IntegerField(default=0)def __unicode__(self):return self.choice_textwhen I try to run this code , I am getting the above error.I am using Windows 8. Please help!!!!!!
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/979241e3-43ab-41fb-9148-4a3fd9022c15%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEhE%2BOnJ6zgCnxLbGEZzPWOM6ii7HUU02U7CaLkMp4MEvNVtTw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment