mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-20 01:36:00 +02:00
filter by READY, edge case handling
This commit is contained in:
parent
09c0a5f392
commit
26947d4bd2
2 changed files with 30 additions and 17 deletions
|
@ -3,13 +3,6 @@
|
||||||
{% block object-tools %}
|
{% block object-tools %}
|
||||||
|
|
||||||
<ul class="object-tools">
|
<ul class="object-tools">
|
||||||
{% if has_add_permission %}
|
|
||||||
<li>
|
|
||||||
<a href="{% url 'admin:registrar_domain_add' %}" class="addlink">
|
|
||||||
Add Domain
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
<li>
|
<li>
|
||||||
<a href="{% url 'admin:registrar_domain_export_data_type' %}" class="button">Export all domain metadata</a>
|
<a href="{% url 'admin:registrar_domain_export_data_type' %}" class="button">Export all domain metadata</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -19,5 +12,12 @@
|
||||||
<li>
|
<li>
|
||||||
<a href="{% url 'admin:registrar_domain_export_data_federal' %}" class="button">Export current-federal.csv</a>
|
<a href="{% url 'admin:registrar_domain_export_data_federal' %}" class="button">Export current-federal.csv</a>
|
||||||
</li>
|
</li>
|
||||||
|
{% if has_add_permission %}
|
||||||
|
<li>
|
||||||
|
<a href="{% url 'admin:registrar_domain_add' %}" class="addlink">
|
||||||
|
Add Domain
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -1,4 +1,5 @@
|
||||||
import csv
|
import csv
|
||||||
|
from registrar.models.domain import Domain
|
||||||
from registrar.models.domain_information import DomainInformation
|
from registrar.models.domain_information import DomainInformation
|
||||||
from registrar.models.public_contact import PublicContact
|
from registrar.models.public_contact import PublicContact
|
||||||
|
|
||||||
|
@ -25,16 +26,28 @@ def export_domains_to_writer(writer, columns, sort_fields, filter_condition):
|
||||||
"State": domainInfo.state_territory,
|
"State": domainInfo.state_territory,
|
||||||
"AO": domainInfo.authorizing_official.first_name
|
"AO": domainInfo.authorizing_official.first_name
|
||||||
+ " "
|
+ " "
|
||||||
+ domainInfo.authorizing_official.last_name,
|
+ domainInfo.authorizing_official.last_name
|
||||||
"AO email": domainInfo.authorizing_official.email,
|
if domainInfo.authorizing_official
|
||||||
|
else " ",
|
||||||
|
"AO email": domainInfo.authorizing_official.email
|
||||||
|
if domainInfo.authorizing_official
|
||||||
|
else " ",
|
||||||
"Submitter": domainInfo.submitter.first_name
|
"Submitter": domainInfo.submitter.first_name
|
||||||
+ " "
|
+ " "
|
||||||
+ domainInfo.submitter.last_name,
|
+ domainInfo.submitter.last_name
|
||||||
"Submitter title": domainInfo.submitter.title,
|
if domainInfo.submitter
|
||||||
"Submitter email": domainInfo.submitter.email,
|
else " ",
|
||||||
"Submitter phone": domainInfo.submitter.phone,
|
"Submitter title": domainInfo.submitter.title
|
||||||
|
if domainInfo.submitter
|
||||||
|
else " ",
|
||||||
|
"Submitter email": domainInfo.submitter.email
|
||||||
|
if domainInfo.submitter
|
||||||
|
else " ",
|
||||||
|
"Submitter phone": domainInfo.submitter.phone
|
||||||
|
if domainInfo.submitter
|
||||||
|
else " ",
|
||||||
"Security Contact Email": security_contacts[0].email
|
"Security Contact Email": security_contacts[0].email
|
||||||
if security_contacts.exists()
|
if security_contacts
|
||||||
else " ",
|
else " ",
|
||||||
"Status": domainInfo.domain.state,
|
"Status": domainInfo.domain.state,
|
||||||
}
|
}
|
||||||
|
@ -62,7 +75,7 @@ def export_data_type_to_csv(csv_file):
|
||||||
# 'Expiration Date'
|
# 'Expiration Date'
|
||||||
]
|
]
|
||||||
sort_fields = ["domain__name"]
|
sort_fields = ["domain__name"]
|
||||||
filter_condition = {}
|
filter_condition = {"domain__state": Domain.State.READY}
|
||||||
export_domains_to_writer(writer, columns, sort_fields, filter_condition)
|
export_domains_to_writer(writer, columns, sort_fields, filter_condition)
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,7 +92,7 @@ def export_data_full_to_csv(csv_file):
|
||||||
"Security Contact Email",
|
"Security Contact Email",
|
||||||
]
|
]
|
||||||
sort_fields = ["domain__name", "federal_agency", "organization_type"]
|
sort_fields = ["domain__name", "federal_agency", "organization_type"]
|
||||||
filter_condition = {}
|
filter_condition = {"domain__state": Domain.State.READY}
|
||||||
export_domains_to_writer(writer, columns, sort_fields, filter_condition)
|
export_domains_to_writer(writer, columns, sort_fields, filter_condition)
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,5 +109,5 @@ def export_data_federal_to_csv(csv_file):
|
||||||
"Security Contact Email",
|
"Security Contact Email",
|
||||||
]
|
]
|
||||||
sort_fields = ["domain__name", "federal_agency", "organization_type"]
|
sort_fields = ["domain__name", "federal_agency", "organization_type"]
|
||||||
filter_condition = {"organization_type__icontains": "federal"}
|
filter_condition = {"organization_type__icontains": "federal", "domain__state": Domain.State.READY}
|
||||||
export_domains_to_writer(writer, columns, sort_fields, filter_condition)
|
export_domains_to_writer(writer, columns, sort_fields, filter_condition)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue