Hi thanks for taking the time to explain to me! Unfortunately I still don't understand the outputs that I get in Python console, maybe it's because I don't understand the concept of templates. But this is what I tried to do in Python console.
>>> p=Poll(question="Giddeup'ah!", pub_date=timezone.now()) >>> p.save() >>> p.id 4 >>> p.question "Giddeup'ah!" >>> *p.pub_date* datetime.datetime(2012, 5, 1, *18, 25*, 39, 804854, tzinfo=<*UTC*>) >>> *Poll.objects.all()* [<Poll: Waddup'ah? 2012-04-26 08:39:20.605340+00:00>, <Poll: What's up? 2012-04-26 10:30:23.624835+00:00>, <Poll: How do you do? 2012-04-26 20:34:33.337247+00:00>, <Poll: Giddeup'ah! 2012-05-01 *18:25*:39.804854*+00:00*>] p.pub_date and Poll.objects.all() show the same time info, so how do I see the time with the simplest of templates? Also when I tried typing "poll.pub_date" in different ways I get these errors. >>> *Poll.pub_date* Traceback (most recent call last): File "<console>", line 1, in <module> AttributeError: type object 'Poll' has no attribute 'pub_date' >>> *poll.pub_date* Traceback (most recent call last): File "<console>", line 1, in <module> NameError: name 'poll' is not defined >>> *poll.pub_date()* Traceback (most recent call last): File "<console>", line 1, in <module> NameError: name 'poll' is not defined >>> *Poll.pub_date()* Traceback (most recent call last): File "<console>", line 1, in <module> AttributeError: type object 'Poll' has no attribute 'pub_date' Here's a better overview of what my relevant files looks like and what setup I have tried to use. Maybe it will help in finding if I have mis-configured something. http://www.python-forum.org/pythonforum/viewtopic.php?f=19&t=34082 On Tuesday, May 1, 2012 3:16:33 PM UTC+2, akaariai wrote: > > On Apr 30, 11:03 pm, Dan Santos <dansanto...@gmail.com> wrote: > > Hi I'm a total programming newbie! > > > > ### INTRO ### > > I have been following this tutorial and the timezone outputs confuses > > me. > https://docs.djangoproject.com/en/1.4/intro/tutorial01/#playing-with-... > > > > And I'm still confused after reading these explanations, I basically > > need some really dumbed down answers to understand this timezone > > business: > > > > <b>TIME_ZONE setting: How does it work?</b> > http://groups.google.com/group/django-users/browse_thread/thread/bebb... > > > > ### QUESTION ### > > * Europe/Brussels has UTC+2 during summer time. > > > > When I run this as I follow the Django tutorial, then the time (20:34) > > is behind by 2 hours to my local time and UTC displays +00:00. > > Shouldn't it display 22:34 +02:00 instead for a server located at > > Europe/Brussels? > > > > >>> Poll.objects.all() > > > > <Poll: How do you do? 2012-04-26 20:34:33.337247+00:00>] > > Internally Django works in UTC . When you display a value in a > template or in a form it will be converted to the currently active > time zone (by default settings.TIMEZONE). So, when you just do > Poll.objects.all() you will see the UTC time, as this is Python > internal representation. If you would do {{poll.pub_date}} in the > template, it would be displayed in the time zone you have currently > active. > > - Anssi -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/9SO8KvbCNA0J. 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.