Skip to content

How to handle auto_now=True fields? #195

@LincolnPuzey

Description

@LincolnPuzey

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:

  1. Make no changes and document behavior. Users can override save() / save_dirty_fields() / get_dirty_fields() if they need something else.
  2. Keep (a) the same but make some change to save_dirty_fields. E.g. my suggestion here
  3. Make auto_now=True fields appear as dirty so save_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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions