From e9f6af279c98260e2bd81d1a4b34f000e9469636 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 7 Jan 2019 12:06:07 +0100 Subject: Tests: M2M history on finds - save and display --- ishtar_common/models.py | 6 +++++- ishtar_common/templatetags/link_to_window.py | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'ishtar_common') diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 319f19539..c7223c898 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -175,9 +175,13 @@ class HistoricalRecords(BaseHistoricalRecords): q = q_history.filter(history_date__isnull=False, history_date__gt=min_history_date) \ .order_by('-history_date', '-history_id') - if q.count(): + force = getattr(instance, "_force_history", False) + if not force and q.count(): return + if force: + delattr(instance, '_force_history') + if 'history_date' not in attrs or not attrs['history_date']: attrs['history_date'] = datetime.datetime.now() # record a new version only if data have been changed diff --git a/ishtar_common/templatetags/link_to_window.py b/ishtar_common/templatetags/link_to_window.py index 892492895..439602665 100644 --- a/ishtar_common/templatetags/link_to_window.py +++ b/ishtar_common/templatetags/link_to_window.py @@ -30,7 +30,6 @@ def link_to_window(item, context): else: return u"" if not item.can_view(request): - print(item, "NOK3") return u"" return simple_link_to_window(item) -- cgit v1.2.3