Ticket #1069 (closed defect: duplicate)
ORM freezing does not like Django 1.4 with USE_TZ turned on.
| Reported by: | adamfast@… | Owned by: | andrew |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | migrations | Version: | 0.7.3 |
| Keywords: | timezones 1.4 use_tz | Cc: |
Description
I've got a recently-ported Django 1.4 application that I started using USE_TZ = True on. When you create a migration with USE_TZ on the representation of a non-null datetime field (this case auth.User) looks like:
'date_joined': ('django.db.models.fields.DateTimeField?', [], {'default': 'datetime.datetime(2012, 4, 23, 3, 26, 40, 71715, tzinfo=<UTC>)'}),
Pre-USE_TZ was
'date_joined': ('django.db.models.fields.DateTimeField?', [], {'default': 'datetime.datetime(2012, 4, 10, 20, 5, 47, 133426)'}),
The new way throws an error as it tries to eval the <UTC> portion like this:
File "/Users/adam/.virtualenvs/theapp/lib/python2.7/site-packages/south/orm.py", line 235, in eval_in_context
return eval(code, globals(), fake_locals)
File "<string>", line 1
SouthFieldClass?(default=datetime.datetime(2012, 4, 23, 3, 26, 40, 71461, tzinfo=<UTC>))
SyntaxError?: invalid syntax
I did have 0.7.3 but upgraded to 0.7.4 just in case.

This bug (#1012) was fixed in 0.7.4. You'll have to delete any migrations that 0.7.3 made with UZE_TZ = True before everything will work (the bug was in the migration creation, so just upgrading South after you've made one won't work).