From 347bd90a73d4c8aa3066d4c0d98c2b59598dadef Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 3 Jun 2021 22:24:12 +0200 Subject: QAPackaging: fix treatment type filter --- archaeological_finds/forms_treatments.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/archaeological_finds/forms_treatments.py b/archaeological_finds/forms_treatments.py index 6c22b30ee..907ea17b4 100644 --- a/archaeological_finds/forms_treatments.py +++ b/archaeological_finds/forms_treatments.py @@ -460,7 +460,6 @@ class QAFindTreatmentForm(IshtarForm): for tt in tt_change_ref_loca ) - tt_change_current_loca = list( models.TreatmentType.objects.filter( available=True, change_current_location=True).all()) @@ -470,8 +469,10 @@ class QAFindTreatmentForm(IshtarForm): for tt in tt_change_current_loca ) - self.treatment_type_all_choices = self.treatment_type_ref_choices + \ - self.treatment_type_current_choices + self.treatment_type_all_choices = "".join( + "".format(tt.pk, str(tt)) + for tt in set(tt_change_current_loca + tt_change_ref_loca) + ) super(QAFindTreatmentForm, self).__init__(*args, **kwargs) if not self.user: @@ -479,7 +480,7 @@ class QAFindTreatmentForm(IshtarForm): # treatment type is dynamic put all for check self.fields['treatment_type'].choices = [ - (tt.pk, str(tt)) for tt in ( + (tt.pk, str(tt)) for tt in set( tt_change_ref_loca + tt_change_current_loca) ] -- cgit v1.2.3