From 12ddfad2540d83959f286c9590a883bcec024c1d Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Thu, 27 Feb 2020 14:59:01 +0100 Subject: [PATCH] Update JSON --- apps/logs/signals.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/logs/signals.py b/apps/logs/signals.py index bed59eb7..2d7f2711 100644 --- a/apps/logs/signals.py +++ b/apps/logs/signals.py @@ -60,9 +60,8 @@ def save_object(sender, instance, **kwargs): user, ip = get_user_and_ip(sender) - from rest_framework.renderers import JSONRenderer - previous_json = JSONRenderer().render(previous) - instance_json = JSONRenderer().render(instance) + previous_json = serializers.serialize('json', previous)[1:-1] if previous.exists else None + instance_json = serializers.serialize('json', [instance, ])[1:-1] Changelog.objects.create(user=user, ip=ip, model=ContentType.objects.get_for_model(instance),