Skip to content

Commit 75216be

Browse files
committed
Bugfix: Temporary fix around pre_save issues on create with M2M.
1 parent 6b9ad45 commit 75216be

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

easyaudit/signals/model_signals.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ def pre_save(sender, instance, raw, using, update_fields, **kwargs):
5252
with transaction.atomic():
5353
if not should_audit(instance):
5454
return False
55-
object_json_repr = serializers.serialize("json", [instance])
55+
try:
56+
object_json_repr = serializers.serialize("json", [instance])
57+
except Exception:
58+
# We need a better way for this to work. ManyToMany will fail on pre_save on create
59+
return None
5660

5761
if instance.pk is None:
5862
created = True

0 commit comments

Comments
 (0)