Content type stored in logs instead of model name
This commit is contained in:
parent
fd529a53c8
commit
1c0bf21cbe
2 changed files with 6 additions and 3 deletions
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
import inspect
|
||||
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core import serializers
|
||||
from django.db.models.signals import pre_save, pre_delete
|
||||
from django.dispatch import receiver
|
||||
|
|
@ -44,7 +45,7 @@ def save_object(sender, instance, **kwargs):
|
|||
previous_json = None
|
||||
instance_json = serializers.serialize('json', [instance, ],)[1:-1]
|
||||
Changelog.objects.create(user=user,
|
||||
model=model_name,
|
||||
model=ContentType.objects.get_for_model(instance),
|
||||
instance_pk=instance.pk,
|
||||
previous=previous_json,
|
||||
data=instance_json,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue