Update JSON

This commit is contained in:
Yohann D'ANELLO 2020-02-27 14:59:01 +01:00
parent 2f51057f4c
commit 12ddfad254
1 changed files with 2 additions and 3 deletions

View File

@ -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),