2012/3/1 Yo-Yo Ma <baxterstock...@gmail.com>

> django/db/models/fields/__init__.py:808: RuntimeWarning: DateTimeField
> received a naive datetime (2012-01-01 00:00:00) while time zone support is
> active.
>
> The above warning is caused by a JSON fixture having "2012-01-01 00:00:00"
> for a DateTimeField timestamp.
>

Indeed, a fixture that was generated with USE_TZ = False (or before time
zone support existed) will raise warnings when it's loaded with USE_TZ =
True.

Does this mean that fixture loading needs to be modified to account for the
> new timezone code, or was is this just a side effect of keeping fixture
> loading backward-compatible?


The code is backwards compatible: assuming you haven't changed TIME_ZONE,
you will get the data you expect in the database. The warning is just a
hint that you should regenerate your fixture.

One of the goal of time zone support was to ensure that developers don't
accidentally perform "unsafe" (under-specified) operations. Interpreting
the naive datetime stored in your fixture in an aware environment is
unsafe. Whenever this sort of thing happens, Django raises a warning.

 --
Aymeric.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to