﻿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
23365	Add support for serializing timezone-aware datetimes in migrations	rasca	Rudy Mutter	"When adding a new not nullable DateTimeField to a model it prompts you to select a default:

{{{
You are trying to add a non-nullable field '...' to user without a default;
we can't do that (the database needs something to populate existing rows).
Please select a fix:
 1) Provide a one-off default now (will be set on all existing rows)
 2) Quit, and let me add a default in models.py
Select an option: 1
Please enter the default value now, as valid Python
The datetime module is available, so you can do e.g. datetime.date.today()
}}}

If you have `USE_TZ = True` then using `datetime.date.today()` and executing the migration results in:

{{{
RuntimeWarning: DateTimeField ... received a naive datetime (...) while time zone support is active.
}}}

I think we should be using:

{{{
>>> django.utils.timezone.now
Invalid input: name 'django' is not defined
}}}

but it's not possible. I think we should add the django namespace to the prompt and use a different message in case `USE_TZ = True`

"	New feature	closed	Migrations	1.7-rc-3	Normal	fixed	migration		Accepted	1	0	0	0	0	0
