From 491c01c6c168c564674c12468077076bf8234af2 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 17 Mar 2025 16:37:53 +0100 Subject: 🐛 treatment type form: fix filter of treatment type by availability (refs #6143) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- archaeological_finds/forms_treatments.py | 2 +- archaeological_finds/models_finds.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/archaeological_finds/forms_treatments.py b/archaeological_finds/forms_treatments.py index 0f25363ee..2c10028d4 100644 --- a/archaeological_finds/forms_treatments.py +++ b/archaeological_finds/forms_treatments.py @@ -313,7 +313,7 @@ class BaseTreatmentForm(CustomForm, ManageOldType): try: treatment_types = [ models.TreatmentType.objects.get( - pk=pk, available=True, + pk=pk, upstream_is_many=self.UPSTREAM_IS_MANY, downstream_is_many=self.DOWNSTREAM_IS_MANY) for pk in data.get('treatment_type', [])] diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 08cf4f4d2..f140c2d61 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -216,6 +216,7 @@ class TreatmentType(HierarchicalType): rank = types[-1].rank else: type_list = [idx for idx, __ in types] + dct["available"] = True q = cls.objects.filter(**dct).exclude(pk__in=type_list) for t in q.all(): if instances: -- cgit v1.2.3