From 835530e71b8d5ffadd746b2e57775c24b72c0926 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 19 Apr 2017 11:33:55 +0200 Subject: Force history date for first historic save --- ishtar_common/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ishtar_common') 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 -- cgit v1.2.3