From 90e08b4863dfaecafee5b151478bda4513b12e85 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 23 Mar 2012 19:29:40 -0500 Subject: 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 --- main/migrations/0054_auto__add_field_donor_created.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'main/migrations/0054_auto__add_field_donor_created.py') diff --git a/main/migrations/0054_auto__add_field_donor_created.py b/main/migrations/0054_auto__add_field_donor_created.py index f4d5b15..c96c0f5 100644 --- a/main/migrations/0054_auto__add_field_donor_created.py +++ b/main/migrations/0054_auto__add_field_donor_created.py @@ -1,5 +1,6 @@ # encoding: utf-8 import datetime +from pytz import utc from south.db import db from south.v2 import SchemaMigration from django.db import models @@ -8,7 +9,9 @@ class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Donor.created' - db.add_column('donors', 'created', self.gf('django.db.models.fields.DateTimeField')(default=datetime.date(2000, 1, 1)), keep_default=False) + old_date = datetime.datetime(2000, 1, 1) + old_date = old_date.replace(tzinfo=utc) + db.add_column('donors', 'created', self.gf('django.db.models.fields.DateTimeField')(default=old_date), keep_default=False) def backwards(self, orm): -- cgit v1.2.3-24-g4f1b