1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-22 08:38:29 +02:00

Don't trigger signals on raw imports

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2023-03-22 14:42:14 +01:00
parent 7364d27b4b
commit 30efff0d9d
3 changed files with 20 additions and 18 deletions

View File

@ -34,13 +34,13 @@ def pre_save_object(sender, instance, **kwargs):
instance._previous = None
def save_object(sender, instance, **kwargs):
def save_object(sender, instance, raw, **kwargs):
"""
Each time a model is saved, an entry in the table `Changelog` is added in the database
in order to store each modification made
"""
# noinspection PyProtectedMember
if instance._meta.label_lower in EXCLUDED or hasattr(instance, "_no_signal"):
if instance._meta.label_lower in EXCLUDED or hasattr(instance, "_no_signal") or raw:
return
# noinspection PyProtectedMember