diff options
Diffstat (limited to 'ishtar_common/utils.py')
| -rw-r--r-- | ishtar_common/utils.py | 11 | 
1 files changed, 6 insertions, 5 deletions
| diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index ba77a07e4..cbc7d069d 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -949,11 +949,12 @@ def m2m_historization_changed(sender, **kwargs):          q = obj.history.filter(              history_modifier_id=obj.history_modifier_id,          ).order_by('-history_date', '-history_id') -        hist = q.all()[0] -        hist.history_m2m = hist_values -        hist.history_date = hist.last_modified = datetime.datetime.now() -        hist.save() -        obj.skip_history_when_saving = True +        if q.count(): +            hist = q.all()[0] +            hist.history_m2m = hist_values +            hist.history_date = hist.last_modified = datetime.datetime.now() +            hist.save() +            obj.skip_history_when_saving = True      elif not obj.history_modifier:          obj.skip_history_when_saving = True      obj.save() | 
