summaryrefslogtreecommitdiff
path: root/ishtar_common/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/utils.py')
-rw-r--r--ishtar_common/utils.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py
index 56c6f669f..e293562ff 100644
--- a/ishtar_common/utils.py
+++ b/ishtar_common/utils.py
@@ -931,26 +931,22 @@ def get_urls_for_model(model, views, own=False, autocomplete=False,
return urls
-HISTORY_M2M_SPLIT = u"*||*"
-
-
def m2m_historization_changed(sender, **kwargs):
obj = kwargs.get('instance', None)
if not obj:
return
- hist_values = {}
+ hist_values = obj.history_m2m or {}
for attr in obj.HISTORICAL_M2M:
values = []
for value in getattr(obj, attr).all():
if not hasattr(value, "history_compress"):
continue
values.append(value.history_compress())
- hist_values['historical_' + attr] = HISTORY_M2M_SPLIT.join(values)
- for key in hist_values:
- setattr(obj, key, hist_values[key])
+ hist_values[attr] = values
# force resave of last history record
if hasattr(obj, 'skip_history_when_saving'):
delattr(obj, 'skip_history_when_saving')
+ obj.history_m2m = hist_values
obj._force_history = True
q = obj.history.order_by("-history_date")
if q.count():