diff options
-rw-r--r-- | CHANGES.md | 7 | ||||
-rw-r--r-- | ishtar_common/models_common.py | 5 | ||||
-rw-r--r-- | ishtar_common/version.py | 4 |
3 files changed, 12 insertions, 4 deletions
diff --git a/CHANGES.md b/CHANGES.md index 9fe4c0bf1..f8c7afbcb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,13 @@ Ishtar changelog ================ +v3.1.54 - 2022-03-25 +-------------------- + +### Bugs ### + +- fix item creation when no last_modified is set + v3.1.53 - 2022-03-24 -------------------- 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") diff --git a/ishtar_common/version.py b/ishtar_common/version.py index 96e9aba64..55ccb08ca 100644 --- a/ishtar_common/version.py +++ b/ishtar_common/version.py @@ -1,5 +1,5 @@ -# 3.1.53 -VERSION = (3, 1, 53) +# 3.1.54 +VERSION = (3, 1, 54) def get_version(): |