﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
21578	manage.py dumpdata --format=yaml produces naive datetimes in fixtures	James Schneider	nobody	"The following runtime warnings are produced when --format=yaml is used with manage.py dumpdata:

/usr/local/lib/python2.7/dist-packages/django/db/models/fields/__init__.py:903: RuntimeWarning: DateTimeField User.last_login received a naive datetime (2013-12-08 07:47:16.243704) while time zone support is active.
  RuntimeWarning)

/usr/local/lib/python2.7/dist-packages/django/db/models/fields/__init__.py:903: RuntimeWarning: DateTimeField User.date_joined received a naive datetime (2013-12-08 07:47:16.243704) while time zone support is active.
  RuntimeWarning)


These warnings are easily reproducible with no custom application code. The following steps can be used to replicate the warnings:

Using 1.6/Python 2.7:

1. django-admin.py startproject dummy_project
2. cd dummy_project
3. python manage.py startapp dummy_app
4. Edit dummy_project/settings.py and add 'dummy_app' to INSTALLED_APPS
5. python manage.py syncdb
6. Create new superuser as part of syncdb process.
7. mkdir dummy_app/fixtures
8. python manage.py dumpdata --format=yaml --indent=4 > dummy_app/fixtures/initial_data.yaml
9. python manage.py flush
10. Do NOT create a new user, as the above YAML dump should contain a superuser.
11. The above runtime warnings are generated.


Repeating the above steps using JSON produces no warnings. Note that the datetime format generated during the JSON dump is different.

An initial glance using the above test would indicate that the warnings are only cosmetic, and that the data is inserted into the database correctly, however, given the issue either generating the correct format, or interpreting the given format, this may lead to other problems and probably shouldn't be left to chance.


Examples of format dumps to show differences:

JSON: ""last_login"": ""2013-12-08T08:10:52.397Z""

YAML: last_login: 2013-12-08 08:10:52.397046+00:00



Both of these were dumps using the above steps, based on the same data, and making no other changes to the DB."	Bug	closed	Core (Serialization)	1.6	Normal	duplicate		jrschneider83@…	Unreviewed	0	0	0	0	0	0
