diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-04-30 21:44:14 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-04-30 21:44:14 +0200 |
commit | c3659349ae150ac85ac560a412d4e2febf954f40 (patch) | |
tree | 2f00107eca921f9bb627034a6491fd5e9fd98c9c /ishtar_common | |
parent | 72e1a76db594e892e4f3c9a8a027486774b0f60f (diff) | |
download | Ishtar-c3659349ae150ac85ac560a412d4e2febf954f40.tar.bz2 Ishtar-c3659349ae150ac85ac560a412d4e2febf954f40.zip |
Force history date when not provided
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/models.py | 2 |
1 files changed, 2 insertions, 0 deletions
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]: |