Joe Holloway napisał(a):
> I'm looking to store UTC date/times so I don't have to
worry about
> time zones until I localize the display. From looking
at the code in
> DateTimeField I think I've answered my own question,
but I just want
> to ask here for the sake of conversation. Is there a
way to get the
> auto_now/auto_now_add feature of DateTimeField to use
UTC?
>
> if self.auto_now or (self.auto_now_add and
add):
> value = datetime.datetime.now()
> setattr(model_instance, self.attname,
value)
> return value
>
> I'm thinking my use case isn't all that unique, so if
there's not a
> way to do this, I'm also wondering if this is a
reasonable enhancement
> request? As a workaround, I can simply avoid using
this feature, but
> it is pretty handy.
I'd not rely on auto_now and auto_now_add but write UTC
datetime in
overriden save() method for now.
--
Jarek Zgoda
Skype: jzgoda | GTalk: zgoda jabber.aster.pl | voice:
+48228430101
"We read Knuth so you don't have to." (Tim
Peters)
--~--~---------~--~----~------------~-------~--~----~
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-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|