mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-19 16:04:38 +02:00
Add function definitions
This commit is contained in:
parent
4336f85254
commit
127bf563a7
1 changed files with 12 additions and 0 deletions
|
@ -25,6 +25,12 @@ def write_header(writer, columns):
|
||||||
|
|
||||||
|
|
||||||
def get_domain_infos(filter_condition, sort_fields):
|
def get_domain_infos(filter_condition, sort_fields):
|
||||||
|
"""
|
||||||
|
Returns DomainInformation objects filtered and sorted based on the provided conditions.
|
||||||
|
filter_condition -> A dictionary of conditions to filter the objects.
|
||||||
|
sort_fields -> A list of fields to sort the resulting query set.
|
||||||
|
returns: A queryset of DomainInformation objects
|
||||||
|
"""
|
||||||
domain_infos = (
|
domain_infos = (
|
||||||
DomainInformation.objects.select_related("domain", "authorizing_official")
|
DomainInformation.objects.select_related("domain", "authorizing_official")
|
||||||
.prefetch_related("domain__permissions")
|
.prefetch_related("domain__permissions")
|
||||||
|
@ -192,6 +198,12 @@ def write_domains_csv(
|
||||||
|
|
||||||
|
|
||||||
def get_requests(filter_condition, sort_fields):
|
def get_requests(filter_condition, sort_fields):
|
||||||
|
"""
|
||||||
|
Returns DomainRequest objects filtered and sorted based on the provided conditions.
|
||||||
|
filter_condition -> A dictionary of conditions to filter the objects.
|
||||||
|
sort_fields -> A list of fields to sort the resulting query set.
|
||||||
|
returns: A queryset of DomainRequest objects
|
||||||
|
"""
|
||||||
requests = DomainRequest.objects.filter(**filter_condition).order_by(*sort_fields).distinct()
|
requests = DomainRequest.objects.filter(**filter_condition).order_by(*sort_fields).distinct()
|
||||||
return requests
|
return requests
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue