mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-27 21:16:28 +02:00
init
This commit is contained in:
parent
0fecc199d0
commit
56a8f83e18
3 changed files with 615 additions and 581 deletions
|
@ -151,6 +151,11 @@ class Domain(TimeStampedModel, DomainHelper):
|
||||||
# previously existed but has been deleted from the registry
|
# previously existed but has been deleted from the registry
|
||||||
DELETED = "deleted", "Deleted"
|
DELETED = "deleted", "Deleted"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_state_label(cls, state: str):
|
||||||
|
"""Returns the associated label for a given state value"""
|
||||||
|
return cls(state).label if state else None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_help_text(cls, state) -> str:
|
def get_help_text(cls, state) -> str:
|
||||||
"""Returns a help message for a desired state. If none is found, an empty string is returned"""
|
"""Returns a help message for a desired state. If none is found, an empty string is returned"""
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -142,7 +142,7 @@ class ExportDataType(View):
|
||||||
# match the CSV example with all the fields
|
# match the CSV example with all the fields
|
||||||
response = HttpResponse(content_type="text/csv")
|
response = HttpResponse(content_type="text/csv")
|
||||||
response["Content-Disposition"] = 'attachment; filename="domains-by-type.csv"'
|
response["Content-Disposition"] = 'attachment; filename="domains-by-type.csv"'
|
||||||
csv_export.export_data_type_to_csv(response)
|
csv_export.DomainExport.export_data_type_to_csv(response)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ class ExportDataFull(View):
|
||||||
# Smaller export based on 1
|
# Smaller export based on 1
|
||||||
response = HttpResponse(content_type="text/csv")
|
response = HttpResponse(content_type="text/csv")
|
||||||
response["Content-Disposition"] = 'attachment; filename="current-full.csv"'
|
response["Content-Disposition"] = 'attachment; filename="current-full.csv"'
|
||||||
csv_export.export_data_full_to_csv(response)
|
csv_export.DomainExport.export_data_full_to_csv(response)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ class ExportDataFederal(View):
|
||||||
# Federal only
|
# Federal only
|
||||||
response = HttpResponse(content_type="text/csv")
|
response = HttpResponse(content_type="text/csv")
|
||||||
response["Content-Disposition"] = 'attachment; filename="current-federal.csv"'
|
response["Content-Disposition"] = 'attachment; filename="current-federal.csv"'
|
||||||
csv_export.export_data_federal_to_csv(response)
|
csv_export.DomainExport.export_data_federal_to_csv(response)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,31 +177,23 @@ class ExportDomainRequestDataFull(View):
|
||||||
|
|
||||||
class ExportDataDomainsGrowth(View):
|
class ExportDataDomainsGrowth(View):
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
# Get start_date and end_date from the request's GET parameters
|
|
||||||
# #999: not needed if we switch to django forms
|
|
||||||
start_date = request.GET.get("start_date", "")
|
start_date = request.GET.get("start_date", "")
|
||||||
end_date = request.GET.get("end_date", "")
|
end_date = request.GET.get("end_date", "")
|
||||||
|
|
||||||
response = HttpResponse(content_type="text/csv")
|
response = HttpResponse(content_type="text/csv")
|
||||||
response["Content-Disposition"] = f'attachment; filename="domain-growth-report-{start_date}-to-{end_date}.csv"'
|
response["Content-Disposition"] = f'attachment; filename="domain-growth-report-{start_date}-to-{end_date}.csv"'
|
||||||
# For #999: set export_data_domain_growth_to_csv to return the resulting queryset, which we can then use
|
csv_export.DomainExport.export_data_domain_growth_to_csv(response, start_date, end_date)
|
||||||
# in context to display this data in the template.
|
|
||||||
csv_export.export_data_domain_growth_to_csv(response, start_date, end_date)
|
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
class ExportDataRequestsGrowth(View):
|
class ExportDataRequestsGrowth(View):
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
# Get start_date and end_date from the request's GET parameters
|
|
||||||
# #999: not needed if we switch to django forms
|
|
||||||
start_date = request.GET.get("start_date", "")
|
start_date = request.GET.get("start_date", "")
|
||||||
end_date = request.GET.get("end_date", "")
|
end_date = request.GET.get("end_date", "")
|
||||||
|
|
||||||
response = HttpResponse(content_type="text/csv")
|
response = HttpResponse(content_type="text/csv")
|
||||||
response["Content-Disposition"] = f'attachment; filename="requests-{start_date}-to-{end_date}.csv"'
|
response["Content-Disposition"] = f'attachment; filename="requests-{start_date}-to-{end_date}.csv"'
|
||||||
# For #999: set export_data_domain_growth_to_csv to return the resulting queryset, which we can then use
|
|
||||||
# in context to display this data in the template.
|
|
||||||
csv_export.DomainRequestExport.export_data_requests_growth_to_csv(response, start_date, end_date)
|
csv_export.DomainRequestExport.export_data_requests_growth_to_csv(response, start_date, end_date)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
@ -209,25 +201,21 @@ class ExportDataRequestsGrowth(View):
|
||||||
|
|
||||||
class ExportDataManagedDomains(View):
|
class ExportDataManagedDomains(View):
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
# Get start_date and end_date from the request's GET parameters
|
|
||||||
# #999: not needed if we switch to django forms
|
|
||||||
start_date = request.GET.get("start_date", "")
|
start_date = request.GET.get("start_date", "")
|
||||||
end_date = request.GET.get("end_date", "")
|
end_date = request.GET.get("end_date", "")
|
||||||
response = HttpResponse(content_type="text/csv")
|
response = HttpResponse(content_type="text/csv")
|
||||||
response["Content-Disposition"] = f'attachment; filename="managed-domains-{start_date}-to-{end_date}.csv"'
|
response["Content-Disposition"] = f'attachment; filename="managed-domains-{start_date}-to-{end_date}.csv"'
|
||||||
csv_export.export_data_managed_domains_to_csv(response, start_date, end_date)
|
csv_export.DomainExport.export_data_managed_domains_to_csv(response, start_date, end_date)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
class ExportDataUnmanagedDomains(View):
|
class ExportDataUnmanagedDomains(View):
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
# Get start_date and end_date from the request's GET parameters
|
|
||||||
# #999: not needed if we switch to django forms
|
|
||||||
start_date = request.GET.get("start_date", "")
|
start_date = request.GET.get("start_date", "")
|
||||||
end_date = request.GET.get("end_date", "")
|
end_date = request.GET.get("end_date", "")
|
||||||
response = HttpResponse(content_type="text/csv")
|
response = HttpResponse(content_type="text/csv")
|
||||||
response["Content-Disposition"] = f'attachment; filename="unamanaged-domains-{start_date}-to-{end_date}.csv"'
|
response["Content-Disposition"] = f'attachment; filename="unamanaged-domains-{start_date}-to-{end_date}.csv"'
|
||||||
csv_export.export_data_unmanaged_domains_to_csv(response, start_date, end_date)
|
csv_export.DomainExport.export_data_unmanaged_domains_to_csv(response, start_date, end_date)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue