﻿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
16745	Different times on fields with auto_now and auto_now_add	kantntreiber@…	Michael Mior	"There is a little issue with using ""auto_now"" and ""auto_now_add"" together in one model. Because the time is set by calling datetime.now() in the pre_save method of the field, using together more than one such field would lead to different values for every field. This is bad, as one expects that the time is the time of the creation or change of the object and therefore should be identical across all of its fields.

An example:

{{{
class FooModel(models.Model):
    time_changed = models.DateTimeField(auto_now=True)
    time_created = models.DateTimeField(auto_now_add=True)


In [3]: from models import FooModel

In [4]: o=FooModel()

In [5]: o.time_changed

In [6]: o.save()

In [7]: o.time_changed
Out[7]: datetime.datetime(2011, 9, 2, 11, 21, 37, 582956)

In [8]: o.time_created
Out[8]: datetime.datetime(2011, 9, 2, 11, 21, 37, 582857)
}}}

"	Bug	closed	Database layer (models, ORM)	1.3	Normal	wontfix	auto_now, auto_now_add, DateTimeField, DateField, field	kantntreiber@… Michael Mior	Accepted	1	1	0	1	0	0
