diff options
author | Dan McGee <dan@archlinux.org> | 2012-03-23 19:29:40 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-03-23 19:54:40 -0500 |
commit | 90e08b4863dfaecafee5b151478bda4513b12e85 (patch) | |
tree | d25065edd39e1357ea0fd8b24ea86ce5630a8fb6 /main/models.py | |
parent | bc1ba4e95a3e572779eb8ba8a947e8d3ce165845 (diff) |
Make all datetime objects fully timezone aware
This is most of the transition to Django 1.4 `USE_TZ = True`. We need to
ensure we don't mix aware and non-aware datetime objects when dealing
with datetimes in the code. Add a utc_now() helper method that we can
use most places, and ensure there is always a timezone attached when
necessary.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'main/models.py')
-rw-r--r-- | main/models.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/main/models.py b/main/models.py index 4f2d64ea..7d017242 100644 --- a/main/models.py +++ b/main/models.py @@ -9,7 +9,7 @@ from django.contrib.auth.models import User from django.contrib.sites.models import Site from .fields import PositiveBigIntegerField, PGPKeyField -from .utils import cache_function, make_choice, set_created_field +from .utils import cache_function, make_choice, set_created_field, utc_now class UserProfile(models.Model): @@ -515,7 +515,7 @@ class TodolistPkg(models.Model): def set_todolist_fields(sender, **kwargs): todolist = kwargs['instance'] if not todolist.date_added: - todolist.date_added = datetime.utcnow() + todolist.date_added = utc_now() # connect signals needed to keep cache in line with reality from main.utils import refresh_latest |