summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
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
commitc3659349ae150ac85ac560a412d4e2febf954f40 (patch)
tree2f00107eca921f9bb627034a6491fd5e9fd98c9c /ishtar_common
parent72e1a76db594e892e4f3c9a8a027486774b0f60f (diff)
downloadIshtar-c3659349ae150ac85ac560a412d4e2febf954f40.tar.bz2
Ishtar-c3659349ae150ac85ac560a412d4e2febf954f40.zip
Force history date when not provided
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/models.py2
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]: