DateTimeField(auto_now=True) does not change when update is called
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)
Owner: |
changed from nobody to pandres
|
Triage Stage: |
Unreviewed → Accepted
|
Owner: |
changed from pandres to nobody
|
Resolution: |
→ invalid
|
Status: |
new → closed
|
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.