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 | aab89447a6c19bcc1b2594a3fb620b7e57276fed (patch) | |
tree | 2f00107eca921f9bb627034a6491fd5e9fd98c9c /ishtar_common/models.py | |
parent | a7d4e391051ee378a140ecfa882167275586a074 (diff) | |
download | Ishtar-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.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]: |