1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-26 18:37:12 +00:00

Logs are created post save

This commit is contained in:
Yohann D'ANELLO 2020-02-27 15:35:38 +01:00
parent aecd3fc86f
commit d316c3130c

View File

@ -5,7 +5,7 @@ import inspect
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core import serializers from django.core import serializers
from django.db.models.signals import pre_save, pre_delete from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver from django.dispatch import receiver
from .models import Changelog from .models import Changelog
@ -58,7 +58,7 @@ EXCLUDED = [
'reversion.version', 'reversion.version',
] ]
@receiver(pre_save) @receiver(post_save)
def save_object(sender, instance, **kwargs): def save_object(sender, instance, **kwargs):
# noinspection PyProtectedMember # noinspection PyProtectedMember
if instance._meta.label_lower in EXCLUDED: if instance._meta.label_lower in EXCLUDED:
@ -80,7 +80,7 @@ def save_object(sender, instance, **kwargs):
).save() ).save()
@receiver(pre_delete) @receiver(post_delete)
def delete_object(sender, instance, **kwargs): def delete_object(sender, instance, **kwargs):
# noinspection PyProtectedMember # noinspection PyProtectedMember
if instance._meta.label_lower in EXCLUDED: if instance._meta.label_lower in EXCLUDED: