diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-03-23 14:46:23 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-03-23 14:46:23 +0100 |
commit | 1e3e7c99cfd3a4dc8455795cb081f2071ee78c7d (patch) | |
tree | c2b2132f7a7ee0b82e8bcfc7b763851efb1fea15 /ishtar_common/models_common.py | |
parent | 2a3b40a6808a5d3c9c22000ce93af1e0ec28b496 (diff) | |
download | Ishtar-1e3e7c99cfd3a4dc8455795cb081f2071ee78c7d.tar.bz2 Ishtar-1e3e7c99cfd3a4dc8455795cb081f2071ee78c7d.zip |
Remove auto update for last_modified - add a _no_last_modified_update
Diffstat (limited to 'ishtar_common/models_common.py')
-rw-r--r-- | ishtar_common/models_common.py | 4 |
1 files changed, 3 insertions, 1 deletions
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: |