mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-27 13:06:30 +02:00
corrected sentence case for status and federal type filters. Updated portfolio filter
This commit is contained in:
parent
37a73ab5d4
commit
093fc1523f
1 changed files with 21 additions and 3 deletions
|
@ -1687,7 +1687,7 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
||||||
class StatusListFilter(MultipleChoiceListFilter):
|
class StatusListFilter(MultipleChoiceListFilter):
|
||||||
"""Custom status filter which is a multiple choice filter"""
|
"""Custom status filter which is a multiple choice filter"""
|
||||||
|
|
||||||
title = "Status"
|
title = "status"
|
||||||
parameter_name = "status__in"
|
parameter_name = "status__in"
|
||||||
|
|
||||||
template = "django/admin/multiple_choice_list_filter.html"
|
template = "django/admin/multiple_choice_list_filter.html"
|
||||||
|
@ -1731,7 +1731,7 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
||||||
If we have a portfolio, use the portfolio's federal type. If not, use the
|
If we have a portfolio, use the portfolio's federal type. If not, use the
|
||||||
organization in the Domain Request object."""
|
organization in the Domain Request object."""
|
||||||
|
|
||||||
title = "federal Type"
|
title = "federal type"
|
||||||
parameter_name = "converted_federal_types"
|
parameter_name = "converted_federal_types"
|
||||||
|
|
||||||
def lookups(self, request, model_admin):
|
def lookups(self, request, model_admin):
|
||||||
|
@ -1819,6 +1819,24 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
||||||
if self.value() == "0":
|
if self.value() == "0":
|
||||||
return queryset.filter(Q(is_election_board=False) | Q(is_election_board=None))
|
return queryset.filter(Q(is_election_board=False) | Q(is_election_board=None))
|
||||||
|
|
||||||
|
class PortfolioFilter(admin.SimpleListFilter):
|
||||||
|
"""Define a custom filter for portfolio"""
|
||||||
|
|
||||||
|
title = _("portfolio")
|
||||||
|
parameter_name = "portfolio"
|
||||||
|
|
||||||
|
def lookups(self, request, model_admin):
|
||||||
|
return (
|
||||||
|
("1", _("Yes")),
|
||||||
|
("0", _("No")),
|
||||||
|
)
|
||||||
|
|
||||||
|
def queryset(self, request, queryset):
|
||||||
|
if self.value() == "1":
|
||||||
|
return queryset.filter(Q(portfolio__isnull=False))
|
||||||
|
if self.value() == "0":
|
||||||
|
return queryset.filter(Q(portfolio__isnull=True))
|
||||||
|
|
||||||
# ------ Custom fields ------
|
# ------ Custom fields ------
|
||||||
def custom_election_board(self, obj):
|
def custom_election_board(self, obj):
|
||||||
return "Yes" if obj.is_election_board else "No"
|
return "Yes" if obj.is_election_board else "No"
|
||||||
|
@ -1984,9 +2002,9 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
||||||
GenericOrgFilter,
|
GenericOrgFilter,
|
||||||
FederalTypeFilter,
|
FederalTypeFilter,
|
||||||
ElectionOfficeFilter,
|
ElectionOfficeFilter,
|
||||||
|
PortfolioFilter,
|
||||||
"rejection_reason",
|
"rejection_reason",
|
||||||
InvestigatorFilter,
|
InvestigatorFilter,
|
||||||
"portfolio"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Search
|
# Search
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue