Skip to content

Commit

Permalink
Merge pull request #178 from acdh-oeaw/ms/170-Add-a-alle-selection-to…
Browse files Browse the repository at this point in the history
…-the-class-to-allow-for-unselecting-an-already-selected-class

fix: adds selection for both classes
  • Loading branch information
sennierer authored Nov 10, 2023
2 parents a734279 + fdfbc31 commit 29b99d8
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions paas_theme/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ class PersonFacetedSearchFormNew(FacetedSearchForm):
required=False,
label="Klasse",
choices=[
("beide", "beide Klassen"),
(
"math.-nat. Klasse",
"Mathematisch-Naturwissenschaftliche Klasse",
Expand Down Expand Up @@ -465,12 +466,14 @@ def search(self):
SQ(akademiemitgliedschaft_exact=Exact(mitgliedschaft)), SQ.AND
)
if self.cleaned_data["mtgld_klasse"]:
klasse = "MATHEMATISCH-NATURWISSENSCHAFTLICHE KLASSE" if self.cleaned_data["mtgld_klasse"] == "math.-nat. Klasse" else "PHILOSOPHISCH-HISTORISCHE KLASSE"
mtgld_dic.add(
SQ(klasse_person=Exact(klasse)),
SQ.AND,
)
sqs = sqs.filter(mtgld_dic)
if self.cleaned_data["mtgld_klasse"] != "beide":
klasse = "MATHEMATISCH-NATURWISSENSCHAFTLICHE KLASSE" if self.cleaned_data["mtgld_klasse"] == "math.-nat. Klasse" else "PHILOSOPHISCH-HISTORISCHE KLASSE"
mtgld_dic.add(
SQ(klasse_person=Exact(klasse)),
SQ.AND,
)
if mtgld_dic:
sqs = sqs.filter(mtgld_dic)
# TODO: This looks unnecessary requirement for self.cleaned_data["mtgld_mitgliedschaft"] or self.cleaned_data["mtgld_klasse"]
elif self.cleaned_data["start_date_form"] or self.cleaned_data["end_date_form"]:
ids_person = PAASMembership.objects.get_memberships(
Expand Down

0 comments on commit 29b99d8

Please sign in to comment.