Skip to content
Snippets Groups Projects
Commit 5bbe79be authored by Todd Dembrey's avatar Todd Dembrey
Browse files

Add the filter for the Lead

parent f3196a63
No related branches found
No related tags found
No related merge requests found
from django.contrib.auth import get_user_model
import django_filters as filters import django_filters as filters
import django_tables2 as tables import django_tables2 as tables
from django_tables2.utils import A from django_tables2.utils import A
...@@ -15,7 +17,7 @@ class DashboardTable(tables.Table): ...@@ -15,7 +17,7 @@ class DashboardTable(tables.Table):
status_name = tables.Column(verbose_name="Status") status_name = tables.Column(verbose_name="Status")
stage = tables.Column(verbose_name="Type") stage = tables.Column(verbose_name="Type")
page = tables.Column(verbose_name="Fund") page = tables.Column(verbose_name="Fund")
lead = tables.Column(accessor='round.specific.lead') lead = tables.Column(accessor='round.specific.lead', verbose_name='Lead')
class Meta: class Meta:
model = ApplicationSubmission model = ApplicationSubmission
...@@ -36,6 +38,11 @@ def get_used_funds(request): ...@@ -36,6 +38,11 @@ def get_used_funds(request):
return Page.objects.filter(applicationsubmission__isnull=False).distinct() return Page.objects.filter(applicationsubmission__isnull=False).distinct()
def get_round_leads(request):
User = get_user_model()
return User.objects.filter(round__isnull=False).distinct()
class Select2CheckboxWidgetMixin: class Select2CheckboxWidgetMixin:
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
label = kwargs.get('label') label = kwargs.get('label')
...@@ -55,6 +62,7 @@ class SubmissionFilter(filters.FilterSet): ...@@ -55,6 +62,7 @@ class SubmissionFilter(filters.FilterSet):
round = Select2ModelMultipleChoiceFilter(queryset=get_used_rounds, label='Rounds') round = Select2ModelMultipleChoiceFilter(queryset=get_used_rounds, label='Rounds')
funds = Select2ModelMultipleChoiceFilter(name='page', queryset=get_used_funds, label='Funds') funds = Select2ModelMultipleChoiceFilter(name='page', queryset=get_used_funds, label='Funds')
status = Select2MultipleChoiceFilter(name='status__contains', choices=status_options, label='Status') status = Select2MultipleChoiceFilter(name='status__contains', choices=status_options, label='Status')
lead = Select2ModelMultipleChoiceFilter(name='round__lead', queryset=get_round_leads, label='Lead')
class Meta: class Meta:
model = ApplicationSubmission model = ApplicationSubmission
......
{% extends "base-admin.html" %} {% extends "base-apply.html" %}
{% load render_table from django_tables2 %} {% load render_table from django_tables2 %}
{% block extra_css %} {% block extra_css %}
......
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