diff options
Diffstat (limited to 'ishtar_common/models_common.py')
-rw-r--r-- | ishtar_common/models_common.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index dbca97367..48c1e9dc1 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() + last_modified = models.DateTimeField(blank=True, default=datetime.datetime.now) history_m2m = JSONField(default={}, blank=True) need_update = models.BooleanField(verbose_name=_("Need update"), default=False) locked = models.BooleanField( @@ -1552,7 +1552,8 @@ class BaseHistorizedItem( def save(self, *args, **kwargs): created = not self.pk - if not getattr(self, "_no_last_modified_update", False): + if not getattr(self, "_no_last_modified_update", False) \ + or not self.last_modified: self.last_modified = datetime.datetime.now() if not getattr(self, "skip_history_when_saving", False): assert hasattr(self, "history_modifier") |