From c3659349ae150ac85ac560a412d4e2febf954f40 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sun, 30 Apr 2017 21:44:14 +0200 Subject: Force history date when not provided --- ishtar_common/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 2475cd289..c4e0c9b92 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -203,6 +203,8 @@ class HistoricalRecords(BaseHistoricalRecords): if q.count(): return + if 'history_date' not in attrs or not attrs['history_date']: + attrs['history_date'] = datetime.now() # record a new version only if data have been changed for field in instance._meta.fields: if getattr(old_instance, field.attname) != attrs[field.attname]: -- cgit v1.2.3