From 1e3e7c99cfd3a4dc8455795cb081f2071ee78c7d Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 23 Mar 2022 14:46:23 +0100 Subject: Remove auto update for last_modified - add a _no_last_modified_update --- CHANGES.md | 8 ++++++++ ishtar_common/models_common.py | 4 +++- ishtar_common/version.py | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index bfeb8a3de..0ffe40bc7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,14 @@ Ishtar changelog ================ +v3.1.52 - 2022-03-23 +-------------------- + +### Bugs ### + +- remove auto update for last_modified - add a _no_last_modified_update + + v3.1.51 - 2022-03-09 -------------------- diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index 40b188158..445aa6647 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -1303,7 +1303,7 @@ class BaseHistorizedItem( blank=True, null=True, ) - last_modified = models.DateTimeField(auto_now=True) + last_modified = models.DateTimeField() history_m2m = JSONField(default={}, blank=True) need_update = models.BooleanField(verbose_name=_("Need update"), default=False) locked = models.BooleanField( @@ -1547,6 +1547,8 @@ class BaseHistorizedItem( def save(self, *args, **kwargs): created = not self.pk + if not getattr(self, "_no_last_modified_update", False): + self.last_modified = datetime.datetime.now() if not getattr(self, "skip_history_when_saving", False): assert hasattr(self, "history_modifier") if created: diff --git a/ishtar_common/version.py b/ishtar_common/version.py index a16106795..19fb137c0 100644 --- a/ishtar_common/version.py +++ b/ishtar_common/version.py @@ -1,5 +1,5 @@ -# 3.1.51 -VERSION = (3, 1, 51) +# 3.1.52 +VERSION = (3, 1, 52) def get_version(): -- cgit v1.2.3