diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-04-19 11:33:55 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-04-19 11:33:55 +0200 |
commit | 835530e71b8d5ffadd746b2e57775c24b72c0926 (patch) | |
tree | 4ca3c01a8b710f13367d9bf424ec0c6b8efc3cd9 /ishtar_common | |
parent | cc5424719f63f7dc81c4736f66c51c632ac09b3d (diff) | |
download | Ishtar-835530e71b8d5ffadd746b2e57775c24b72c0926.tar.bz2 Ishtar-835530e71b8d5ffadd746b2e57775c24b72c0926.zip |
Force history date for first historic save
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/models.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index ea2f47af2..357140ea4 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -185,7 +185,7 @@ class HistoricalRecords(BaseHistoricalRecords): history_modifier = getattr(instance, 'history_modifier', None) assert history_modifier except (User.DoesNotExist, AssertionError): - # on batch removing of users, user could have disapeared + # on batch removing of users, user could have disappeared return manager = getattr(instance, self.manager_name) attrs = {} @@ -195,7 +195,8 @@ class HistoricalRecords(BaseHistoricalRecords): .filter(history_modifier_id=history_modifier.pk)\ .order_by('-history_date', '-history_id') if not q_history.count(): - manager.create(history_type=type, **attrs) + manager.create(history_type=type, + history_date=datetime.datetime.now(), **attrs) return old_instance = q_history.all()[0] # multiple saving by the same user in a very short time are generaly |