mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-27 04:58:42 +02:00
cleanup
This commit is contained in:
parent
0446aaba60
commit
31563152da
1 changed files with 11 additions and 11 deletions
|
@ -2809,17 +2809,6 @@ class DomainAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
||||||
)
|
)
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
def get_queryset(self, request):
|
|
||||||
"""Custom get_queryset to filter by portfolio if portfolio is in the
|
|
||||||
request params."""
|
|
||||||
qs = super().get_queryset(request)
|
|
||||||
# Check if a 'portfolio' parameter is passed in the request
|
|
||||||
portfolio_id = request.GET.get("portfolio")
|
|
||||||
if portfolio_id:
|
|
||||||
# Further filter the queryset by the portfolio
|
|
||||||
qs = qs.filter(domain_info__portfolio=portfolio_id)
|
|
||||||
return qs
|
|
||||||
|
|
||||||
# Filters
|
# Filters
|
||||||
list_filter = [GenericOrgFilter, FederalTypeFilter, ElectionOfficeFilter, "state"]
|
list_filter = [GenericOrgFilter, FederalTypeFilter, ElectionOfficeFilter, "state"]
|
||||||
|
|
||||||
|
@ -3228,6 +3217,17 @@ class DomainAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
||||||
return True
|
return True
|
||||||
return super().has_change_permission(request, obj)
|
return super().has_change_permission(request, obj)
|
||||||
|
|
||||||
|
def get_queryset(self, request):
|
||||||
|
"""Custom get_queryset to filter by portfolio if portfolio is in the
|
||||||
|
request params."""
|
||||||
|
qs = super().get_queryset(request)
|
||||||
|
# Check if a 'portfolio' parameter is passed in the request
|
||||||
|
portfolio_id = request.GET.get("portfolio")
|
||||||
|
if portfolio_id:
|
||||||
|
# Further filter the queryset by the portfolio
|
||||||
|
qs = qs.filter(domain_info__portfolio=portfolio_id)
|
||||||
|
return qs
|
||||||
|
|
||||||
|
|
||||||
class DraftDomainResource(resources.ModelResource):
|
class DraftDomainResource(resources.ModelResource):
|
||||||
"""defines how each field in the referenced model should be mapped to the corresponding fields in the
|
"""defines how each field in the referenced model should be mapped to the corresponding fields in the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue