﻿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
35037	DateTimeField with auto_now_add and default is inconsistent/broken	Norbert Preining	nobody	"I wanted to update a model by adding a field
{{{
created_at = models.DateTimeField(auto_now_add=True)
}}}


But when I wanted to create migrations I got:
{{{
$ python manage.py makemigrations users
It is impossible to add the field 'created_at' with 'auto_now_add=True' to customuser without providing a default. This is because the database needs something to populate existing rows.
 1) Provide a one-off default now which will be set on all existing rows
 2) Quit and manually define a default value in models.py.
Select an option: 2
}}}

Ok, according to this, I added a default as in 
{{{
created_at = models.DateTimeField(auto_now_add=True, default=datetime.now)
}}}

but creating migrations still complain:
{{{
$ python manage.py makemigrations users
SystemCheckError: System check identified some issues:

ERRORS:
users.CustomUser.created_at: (fields.E160) The options auto_now, auto_now_add, and default are mutually exclusive. Only one of these options may be present.
}}}

That means, according to the message from manage.py:
- `auto_now`, `auto_now_add`, and `default` are mutually exclusive
- but at the same time, I need to add a default for `auto_now_add` to be added

I am puzzled"	Bug	closed	Core (Management commands)	5.0	Normal	invalid			Unreviewed	0	0	0	0	0	0
