Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#14623 closed (invalid)

DateTimeField(auto_now=True) does not change when update is called

Reported by: mklauber Owned by: nobody
Component: Database layer (models, ORM) Version: 1.2
Severity: Keywords: DateTimeField auto_now
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

According to documentation, the auto_now property of a DateTimeField is supposed to be useful for tracking last modified dates. However, when Type.objects.filter(property1="value1").update(property2="value2") is called these fields are not updated. While the documentation does state that this value is changed when save() is called, the expected behavior is that any change to the record would result in this field updating.

Change History (5)

comment:1 by pandres, 14 years ago

Owner: changed from nobody to pandres

comment:2 by pandres, 14 years ago

Triage Stage: UnreviewedAccepted

comment:3 by pandres, 14 years ago

Owner: changed from pandres to nobody

comment:4 by Luke Plant, 14 years ago

Resolution: invalid
Status: newclosed

I really don't think that the docs for update() would give you the expectations you describe. It is very clear that it works on the level of an SQL update and the save() method is not called, and the docs for DateTimeField are equally clear that auto_now is applied when the object is saved. Django has DB access code on several levels, and we cannot add caveats for every single low level operation in the docs for every single high level operation.

comment:5 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

Note: See TracTickets for help on using tickets.
Back to Top