mirror of https://gitlab.crans.org/bde/nk20
Update excluded models list
This commit is contained in:
parent
12ddfad254
commit
aecd3fc86f
|
@ -43,17 +43,25 @@ def get_user_and_ip(sender):
|
||||||
|
|
||||||
|
|
||||||
EXCLUDED = [
|
EXCLUDED = [
|
||||||
'changelog',
|
'admin.logentry',
|
||||||
'migration',
|
'authtoken.token',
|
||||||
'revision',
|
'cas_server.user',
|
||||||
'session',
|
'cas_server.userattributes',
|
||||||
'version',
|
'contenttypes.contenttype',
|
||||||
|
'logs.changelog',
|
||||||
|
'migrations.migration',
|
||||||
|
'note.noteuser',
|
||||||
|
'note.noteclub',
|
||||||
|
'note.notespecial',
|
||||||
|
'sessions.session',
|
||||||
|
'reversion.revision',
|
||||||
|
'reversion.version',
|
||||||
]
|
]
|
||||||
|
|
||||||
@receiver(pre_save)
|
@receiver(pre_save)
|
||||||
def save_object(sender, instance, **kwargs):
|
def save_object(sender, instance, **kwargs):
|
||||||
model_name = sender.__name__
|
# noinspection PyProtectedMember
|
||||||
if model_name.lower() in EXCLUDED:
|
if instance._meta.label_lower in EXCLUDED:
|
||||||
return
|
return
|
||||||
|
|
||||||
previous = sender.objects.filter(pk=instance.pk).all()
|
previous = sender.objects.filter(pk=instance.pk).all()
|
||||||
|
@ -74,8 +82,8 @@ def save_object(sender, instance, **kwargs):
|
||||||
|
|
||||||
@receiver(pre_delete)
|
@receiver(pre_delete)
|
||||||
def delete_object(sender, instance, **kwargs):
|
def delete_object(sender, instance, **kwargs):
|
||||||
model_name = sender.__name__
|
# noinspection PyProtectedMember
|
||||||
if model_name.lower() in EXCLUDED:
|
if instance._meta.label_lower in EXCLUDED:
|
||||||
return
|
return
|
||||||
|
|
||||||
user, ip = get_user_and_ip(sender)
|
user, ip = get_user_and_ip(sender)
|
||||||
|
|
Loading…
Reference in New Issue