summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
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
commitaab89447a6c19bcc1b2594a3fb620b7e57276fed (patch)
tree2f00107eca921f9bb627034a6491fd5e9fd98c9c /ishtar_common/models.py
parenta7d4e391051ee378a140ecfa882167275586a074 (diff)
downloadIshtar-aab89447a6c19bcc1b2594a3fb620b7e57276fed.tar.bz2
Ishtar-aab89447a6c19bcc1b2594a3fb620b7e57276fed.zip
Force history date when not provided
Diffstat (limited to 'ishtar_common/models.py')
-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]: