From 3450f7475aafc68649410140da471dee04b70fef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Sat, 23 Nov 2024 22:33:39 +0100 Subject: [PATCH] Fix #24: Solve recursion bug when importing templates from a fixture --- shimatta_kenkyusho/parts/models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shimatta_kenkyusho/parts/models.py b/shimatta_kenkyusho/parts/models.py index ee10485..47ea19c 100644 --- a/shimatta_kenkyusho/parts/models.py +++ b/shimatta_kenkyusho/parts/models.py @@ -376,6 +376,12 @@ def auto_apply_template_structure(sender, instance, created, **kwargs): If there are nested sub-storages these will be added when the sub-storages are created automatically. """ + + # Skip recursion if the model is saved 'raw' e.g. when imported + if 'raw' in kwargs: + if kwargs['raw']: + return + if created: if instance.template: for sub_storage in instance.template.storage_set.all():