You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There have been two PRs (#152 and #194) suggesting some sort of change to the current behavior which is that:
a) Fields with auto_now=True do not appear as dirty - they won't appear in .get_dirty_fields()
b) And so by extension .save_dirtyfields() doesn't include them in update_fields so they are not updated by this method.
Some options we have are:
Make no changes and document behavior. Users can override save() / save_dirty_fields() / get_dirty_fields() if they need something else.
Keep (a) the same but make some change to save_dirty_fields. E.g. my suggestion here
Make auto_now=True fields appear as dirty so save_dirtyfields() will update them.
@LincolnPuzey 4th option could be to add a parameter? include_auto_now=True to save_dirty_fields() ? Your comment on the other PR also makes sense.
For the second part of your change - adding the option to save_dirty_fields(), rather than add a special case for auto_now fields, I think adding a generic extra_update_fields argument, eg
But perhaps Option 1 is also ok. We'll try it out and add comments here on any issues we encounter.
There have been two PRs (#152 and #194) suggesting some sort of change to the current behavior which is that:
a) Fields with
auto_now=True
do not appear as dirty - they won't appear in.get_dirty_fields()
b) And so by extension
.save_dirtyfields()
doesn't include them inupdate_fields
so they are not updated by this method.Some options we have are:
save()
/save_dirty_fields()
/get_dirty_fields()
if they need something else.save_dirty_fields
. E.g. my suggestion hereauto_now=True
fields appear as dirty sosave_dirtyfields()
will update them.There was a similar issue and discussion in Django here: https://code.djangoproject.com/ticket/22981 where the resolution was to make no changes.
The text was updated successfully, but these errors were encountered: