Skip to content
Snippets Groups Projects
Commit eb5880d7 authored by Fredrik Jonsson's avatar Fredrik Jonsson
Browse files

Add meta term filter to submission tables.

parent d83dcc32
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,7 @@ from django.utils.translation import ugettext_lazy as _
from django_tables2.utils import A
from wagtail.core.models import Page
from hypha.apply.categories.models import MetaTerm
from hypha.apply.funds.models import ApplicationSubmission, Round, ScreeningStatus
from hypha.apply.funds.workflow import STATUSES, get_review_active_statuses
from hypha.apply.users.groups import STAFF_GROUP_NAME
......@@ -186,6 +187,11 @@ def get_screening_statuses(request):
id__in=ApplicationSubmission.objects.all().values('screening_status__id').distinct('screening_status__id'))
def get_meta_terms(request):
return MetaTerm.objects.filter(
id__in=ApplicationSubmission.objects.all().values('meta_terms__id').distinct('meta_terms__id'))
class Select2CheckboxWidgetMixin(filters.Filter):
def __init__(self, *args, **kwargs):
label = kwargs.get('label')
......@@ -233,6 +239,7 @@ class SubmissionFilter(filters.FilterSet):
lead = Select2ModelMultipleChoiceFilter(queryset=get_round_leads, label='Leads')
reviewers = Select2ModelMultipleChoiceFilter(queryset=get_reviewers, label='Reviewers')
screening_status = Select2ModelMultipleChoiceFilter(queryset=get_screening_statuses, label='Screening')
meta_terms = Select2ModelMultipleChoiceFilter(queryset=get_meta_terms, label='Terms')
class Meta:
model = ApplicationSubmission
......
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