SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 18416f39 authored by George Katsikas's avatar George Katsikas :goat:
Browse files

add nomination filter for missing specialties

parent 720c6879
No related branches found
No related tags found
No related merge requests found
......@@ -563,6 +563,11 @@ class FellowshipNominationSearchForm(forms.Form):
required=False,
initial=True,
)
needs_specialties = forms.BooleanField(
label="Needs specialties",
required=False,
initial=False,
)
orderby = forms.ChoiceField(
label="Order by",
......@@ -609,6 +614,7 @@ class FellowshipNominationSearchForm(forms.Form):
Div(Field("can_vote"), css_class="col-auto col-lg-12 col-xl-auto"),
Div(Field("voting_open"), css_class="col-auto col-lg-12 col-xl-auto"),
Div(Field("has_rounds"), css_class="col-auto col-lg-12 col-xl-auto"),
Div(Field("needs_specialties"), css_class="col-auto col-lg-12 col-xl-auto"),
css_class="row mb-0",
)
......@@ -702,6 +708,8 @@ class FellowshipNominationSearchForm(forms.Form):
)
if self.cleaned_data.get("has_rounds"):
nominations = nominations.filter(voting_rounds__isnull=False)
if self.cleaned_data.get("needs_specialties"):
nominations = nominations.filter(profile__specialties__isnull=True)
# Ordering of nominations
# Only order if both fields are set
......
......@@ -66,9 +66,18 @@
{% if nomination.latest_voting_round %}
{% include "colleges/_hx_voting_round_summary.html" with round=nomination.latest_voting_round %}
{% else %}
<div class="h-100 d-flex align-items-center justify-content-end">
<div class="badge bg-danger fs-6">No rounds created yet</div>
<div class="badge bg-danger fs-6">
{% if not nomination.profile.specialties.all %}
No specialties defined yet
{% else %}
No rounds created yet
{% endif %}
</div>
</div>
{% endif %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment