From 9b963769c2bf4cdd30987be177c39f2324835244 Mon Sep 17 00:00:00 2001 From: Maxim Kolyubyakin Date: Tue, 22 Oct 2024 15:02:03 +0200 Subject: [PATCH] LITE-31232 Fixed access to `bulk_relate_cm` in `cqrs_state` --- dj_cqrs/mixins.py | 2 +- dj_cqrs/signals.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dj_cqrs/mixins.py b/dj_cqrs/mixins.py index 4140ff6..7aedd32 100644 --- a/dj_cqrs/mixins.py +++ b/dj_cqrs/mixins.py @@ -296,7 +296,7 @@ def _class_serialization(self, using, sync=False): instance = None db = using if using is not None else self._state.db - bulk_relate_cm = cqrs_state.bulk_relate_cm + bulk_relate_cm = getattr(cqrs_state, 'bulk_relate_cm', None) if bulk_relate_cm: instance = bulk_relate_cm.get_cached_instance(self, db) diff --git a/dj_cqrs/signals.py b/dj_cqrs/signals.py index 7b02344..a9e9cd1 100644 --- a/dj_cqrs/signals.py +++ b/dj_cqrs/signals.py @@ -65,7 +65,7 @@ def post_save(cls, sender, **kwargs): using = kwargs['using'] - bulk_relate_cm = cqrs_state.bulk_relate_cm + bulk_relate_cm = getattr(cqrs_state, 'bulk_relate_cm', None) if bulk_relate_cm: bulk_relate_cm.register(instance, using)