From 3e20f067e7ff412547ef0d2534e4eadb585789fc Mon Sep 17 00:00:00 2001 From: Birger Schacht Date: Wed, 11 Dec 2024 09:38:02 +0100 Subject: [PATCH] refactor(generic,apis_metainfo)!: move duplicate signals to generic app --- apis_core/apis_metainfo/models.py | 2 +- apis_core/apis_metainfo/signals.py | 4 ---- apis_core/apis_relations/models.py | 2 +- apis_core/apis_relations/signals.py | 3 +-- apis_core/generic/signals.py | 2 ++ apis_core/relations/signals.py | 3 +-- 6 files changed, 6 insertions(+), 10 deletions(-) delete mode 100644 apis_core/apis_metainfo/signals.py diff --git a/apis_core/apis_metainfo/models.py b/apis_core/apis_metainfo/models.py index 9a4589ea9..503fade81 100644 --- a/apis_core/apis_metainfo/models.py +++ b/apis_core/apis_metainfo/models.py @@ -9,7 +9,7 @@ from django.forms import model_to_dict from model_utils.managers import InheritanceManager -from apis_core.apis_metainfo import signals +from apis_core.generic import signals from apis_core.generic.abc import GenericModel from apis_core.utils import rdf from apis_core.utils import settings as apis_settings diff --git a/apis_core/apis_metainfo/signals.py b/apis_core/apis_metainfo/signals.py deleted file mode 100644 index fb989283d..000000000 --- a/apis_core/apis_metainfo/signals.py +++ /dev/null @@ -1,4 +0,0 @@ -from django.db.models.signals import ModelSignal - -pre_duplicate = ModelSignal(use_caching=True) -post_duplicate = ModelSignal(use_caching=True) diff --git a/apis_core/apis_relations/models.py b/apis_core/apis_relations/models.py index 99072e434..66e81fdf8 100644 --- a/apis_core/apis_relations/models.py +++ b/apis_core/apis_relations/models.py @@ -10,8 +10,8 @@ from django.db.models.signals import m2m_changed from model_utils.managers import InheritanceManager -from apis_core.apis_metainfo import signals from apis_core.apis_metainfo.models import RootObject +from apis_core.generic import signals from apis_core.generic.abc import GenericModel from apis_core.history.models import VersionMixin from apis_core.utils import DateParser diff --git a/apis_core/apis_relations/signals.py b/apis_core/apis_relations/signals.py index 9f4e9bacc..e61b6c5cf 100644 --- a/apis_core/apis_relations/signals.py +++ b/apis_core/apis_relations/signals.py @@ -3,9 +3,8 @@ from django.dispatch import receiver from apis_core.apis_metainfo.models import RootObject -from apis_core.apis_metainfo.signals import post_duplicate from apis_core.apis_relations.models import TempTriple -from apis_core.generic.signals import post_merge_with +from apis_core.generic.signals import post_duplicate, post_merge_with logger = logging.getLogger(__name__) diff --git a/apis_core/generic/signals.py b/apis_core/generic/signals.py index 0e07ac932..aba398785 100644 --- a/apis_core/generic/signals.py +++ b/apis_core/generic/signals.py @@ -2,3 +2,5 @@ pre_merge_with = ModelSignal(use_caching=True) post_merge_with = ModelSignal(use_caching=True) +pre_duplicate = ModelSignal(use_caching=True) +post_duplicate = ModelSignal(use_caching=True) diff --git a/apis_core/relations/signals.py b/apis_core/relations/signals.py index 6190cce47..32a5b0998 100644 --- a/apis_core/relations/signals.py +++ b/apis_core/relations/signals.py @@ -3,8 +3,7 @@ from django.contrib.contenttypes.models import ContentType from django.dispatch import receiver -from apis_core.apis_metainfo.signals import post_duplicate -from apis_core.generic.signals import post_merge_with +from apis_core.generic.signals import post_duplicate, post_merge_with from apis_core.relations.models import Relation logger = logging.getLogger(__name__)