mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-28 05:26:28 +02:00
changes thus far
This commit is contained in:
parent
b51251ff3a
commit
24dd5e71a4
4 changed files with 151 additions and 72 deletions
|
@ -1687,6 +1687,49 @@ 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))
|
||||||
|
|
||||||
|
@admin.display(description=_("Generic Org Type"))
|
||||||
|
def converted_generic_org_type(self, obj):
|
||||||
|
return obj.converted_generic_org_type
|
||||||
|
|
||||||
|
@admin.display(description=_("Organization Name"))
|
||||||
|
def converted_organization_name(self, obj):
|
||||||
|
return obj.converted_organization_name
|
||||||
|
|
||||||
|
@admin.display(description=_("Federal Agency"))
|
||||||
|
def converted_federal_agency(self, obj):
|
||||||
|
return obj.converted_federal_agency
|
||||||
|
|
||||||
|
@admin.display(description=_("Federal Type"))
|
||||||
|
def converted_federal_type(self, obj):
|
||||||
|
return obj.converted_federal_type
|
||||||
|
|
||||||
|
@admin.display(description=_("City"))
|
||||||
|
def converted_city(self, obj):
|
||||||
|
return obj.converted_city
|
||||||
|
|
||||||
|
@admin.display(description=_("State/Territory"))
|
||||||
|
def converted_state_territory(self, obj):
|
||||||
|
return obj.converted_state_territory
|
||||||
|
|
||||||
|
@admin.display(description=_("Senior Official"))
|
||||||
|
def converted_senior_official(self, obj):
|
||||||
|
return obj.converted_senior_official
|
||||||
|
|
||||||
|
@admin.display(description=_("Address Line 1"))
|
||||||
|
def converted_address_line1(self, obj):
|
||||||
|
return obj.converted_address_line1
|
||||||
|
|
||||||
|
@admin.display(description=_("Address Line 2"))
|
||||||
|
def converted_address_line2(self, obj):
|
||||||
|
return obj.converted_address_line2
|
||||||
|
|
||||||
|
@admin.display(description=_("Zipcode"))
|
||||||
|
def converted_zipcode(self, obj):
|
||||||
|
return obj.converted_zipcode
|
||||||
|
|
||||||
|
@admin.display(description=_("Urbanization"))
|
||||||
|
def converted_urbanization(self, obj):
|
||||||
|
return obj.converted_urbanization
|
||||||
# Columns
|
# Columns
|
||||||
list_display = [
|
list_display = [
|
||||||
"requested_domain",
|
"requested_domain",
|
||||||
|
@ -1711,6 +1754,8 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
||||||
|
|
||||||
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"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
custom_election_board.admin_order_field = "is_election_board" # type: ignore
|
custom_election_board.admin_order_field = "is_election_board" # type: ignore
|
||||||
custom_election_board.short_description = "Election office" # type: ignore
|
custom_election_board.short_description = "Election office" # type: ignore
|
||||||
|
@ -1847,7 +1892,7 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
||||||
|
|
||||||
# Read only that we'll leverage for CISA Analysts
|
# Read only that we'll leverage for CISA Analysts
|
||||||
analyst_readonly_fields = [
|
analyst_readonly_fields = [
|
||||||
"federal_agency",
|
"converted_federal_agency",
|
||||||
"creator",
|
"creator",
|
||||||
"about_your_organization",
|
"about_your_organization",
|
||||||
"requested_domain",
|
"requested_domain",
|
||||||
|
|
|
@ -327,7 +327,7 @@ This is using a custom implementation fieldset.html (see admin/fieldset.html)
|
||||||
{% if not skip_additional_contact_info %}
|
{% if not skip_additional_contact_info %}
|
||||||
{% include "django/admin/includes/user_detail_list.html" with user=original_object.creator no_title_top_padding=field.is_readonly %}
|
{% include "django/admin/includes/user_detail_list.html" with user=original_object.creator no_title_top_padding=field.is_readonly %}
|
||||||
{% endif%}
|
{% endif%}
|
||||||
{% elif field.field.name == "converted_senior_official" %}
|
{% elif field.field.name == "converted_senior_official" or field.field.name == "senior_official" %}
|
||||||
<div class="flex-container">
|
<div class="flex-container">
|
||||||
<label aria-label="Senior official contact details"></label>
|
<label aria-label="Senior official contact details"></label>
|
||||||
{% include "django/admin/includes/contact_detail_list.html" with user=original_object.senior_official no_title_top_padding=field.is_readonly %}
|
{% include "django/admin/includes/contact_detail_list.html" with user=original_object.senior_official no_title_top_padding=field.is_readonly %}
|
||||||
|
@ -388,7 +388,7 @@ This is using a custom implementation fieldset.html (see admin/fieldset.html)
|
||||||
</details>
|
</details>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% elif field.field.name == "state_territory" and original_object|model_name_lowercase != 'portfolio' %}
|
{% elif field.field.name == "converted_state_territory" or field.field.name == "state_territory" and original_object|model_name_lowercase != 'portfolio' %}
|
||||||
<div class="flex-container margin-top-2">
|
<div class="flex-container margin-top-2">
|
||||||
<span>
|
<span>
|
||||||
CISA region:
|
CISA region:
|
||||||
|
|
|
@ -164,7 +164,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if DomainRequest.get_federal_type %}
|
{% if DomainRequest.get_federal_type %}
|
||||||
{% include "includes/summary_item.html" with title='Federal government branch' value=DomainRequest.get_federal_type heading_level=heading_level %}
|
{% include "includes/summary_item.html" with title='Federal government branch' value=DomainRequest.get_federal_type_display heading_level=heading_level %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if DomainRequest.is_election_board %}
|
{% if DomainRequest.is_election_board %}
|
||||||
|
|
|
@ -1626,56 +1626,66 @@ class TestDomainRequestAdmin(MockEppLib):
|
||||||
readonly_fields = self.admin.get_readonly_fields(request, domain_request)
|
readonly_fields = self.admin.get_readonly_fields(request, domain_request)
|
||||||
|
|
||||||
expected_fields = [
|
expected_fields = [
|
||||||
"other_contacts",
|
'other_contacts',
|
||||||
"current_websites",
|
'current_websites',
|
||||||
"alternative_domains",
|
'alternative_domains',
|
||||||
"is_election_board",
|
'is_election_board',
|
||||||
"status_history",
|
'status_history',
|
||||||
"id",
|
'converted_senior_official',
|
||||||
"created_at",
|
'converted_federal_type',
|
||||||
"updated_at",
|
'converted_federal_agency',
|
||||||
"status",
|
'converted_state_territory',
|
||||||
"rejection_reason",
|
'converted_organization_name',
|
||||||
"rejection_reason_email",
|
'converted_address_line1',
|
||||||
"action_needed_reason",
|
'converted_address_line2',
|
||||||
"action_needed_reason_email",
|
'converted_zipcode',
|
||||||
"federal_agency",
|
'converted_urbanization',
|
||||||
"portfolio",
|
'converted_city',
|
||||||
"sub_organization",
|
'converted_generic_org_type',
|
||||||
"creator",
|
'id',
|
||||||
"investigator",
|
'created_at',
|
||||||
"generic_org_type",
|
'updated_at',
|
||||||
"is_election_board",
|
'status',
|
||||||
"organization_type",
|
'rejection_reason',
|
||||||
"federally_recognized_tribe",
|
'rejection_reason_email',
|
||||||
"state_recognized_tribe",
|
'action_needed_reason',
|
||||||
"tribe_name",
|
'action_needed_reason_email',
|
||||||
"federal_type",
|
'federal_agency', 'portfolio',
|
||||||
"organization_name",
|
'sub_organization',
|
||||||
"address_line1",
|
'creator',
|
||||||
"address_line2",
|
'investigator',
|
||||||
"city",
|
'generic_org_type',
|
||||||
"state_territory",
|
'is_election_board',
|
||||||
"zipcode",
|
'organization_type',
|
||||||
"urbanization",
|
'federally_recognized_tribe',
|
||||||
"about_your_organization",
|
'state_recognized_tribe',
|
||||||
"senior_official",
|
'tribe_name',
|
||||||
"approved_domain",
|
'federal_type',
|
||||||
"requested_domain",
|
'organization_name',
|
||||||
"purpose",
|
'address_line1',
|
||||||
"no_other_contacts_rationale",
|
'address_line2',
|
||||||
"anything_else",
|
'city',
|
||||||
"has_anything_else_text",
|
'state_territory',
|
||||||
"cisa_representative_email",
|
'zipcode',
|
||||||
"cisa_representative_first_name",
|
'urbanization',
|
||||||
"cisa_representative_last_name",
|
'about_your_organization',
|
||||||
"has_cisa_representative",
|
'senior_official',
|
||||||
"is_policy_acknowledged",
|
'approved_domain',
|
||||||
"first_submitted_date",
|
'requested_domain',
|
||||||
"last_submitted_date",
|
'purpose',
|
||||||
"last_status_update",
|
'no_other_contacts_rationale',
|
||||||
"notes",
|
'anything_else',
|
||||||
"alternative_domains",
|
'has_anything_else_text',
|
||||||
|
'cisa_representative_email',
|
||||||
|
'cisa_representative_first_name',
|
||||||
|
'cisa_representative_last_name',
|
||||||
|
'has_cisa_representative',
|
||||||
|
'is_policy_acknowledged',
|
||||||
|
'first_submitted_date',
|
||||||
|
'last_submitted_date',
|
||||||
|
'last_status_update',
|
||||||
|
'notes',
|
||||||
|
'alternative_domains'
|
||||||
]
|
]
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.assertEqual(readonly_fields, expected_fields)
|
self.assertEqual(readonly_fields, expected_fields)
|
||||||
|
@ -1688,25 +1698,37 @@ class TestDomainRequestAdmin(MockEppLib):
|
||||||
readonly_fields = self.admin.get_readonly_fields(request)
|
readonly_fields = self.admin.get_readonly_fields(request)
|
||||||
|
|
||||||
expected_fields = [
|
expected_fields = [
|
||||||
"other_contacts",
|
'other_contacts',
|
||||||
"current_websites",
|
'current_websites',
|
||||||
"alternative_domains",
|
'alternative_domains',
|
||||||
"is_election_board",
|
'is_election_board',
|
||||||
"status_history",
|
'status_history',
|
||||||
"converted_federal_agency",
|
'converted_senior_official',
|
||||||
"creator",
|
'converted_federal_type',
|
||||||
"about_your_organization",
|
'converted_federal_agency',
|
||||||
"requested_domain",
|
'converted_state_territory',
|
||||||
"approved_domain",
|
'converted_organization_name',
|
||||||
"alternative_domains",
|
'converted_address_line1',
|
||||||
"purpose",
|
'converted_address_line2',
|
||||||
"no_other_contacts_rationale",
|
'converted_zipcode',
|
||||||
"anything_else",
|
'converted_urbanization',
|
||||||
"is_policy_acknowledged",
|
'converted_city',
|
||||||
"cisa_representative_first_name",
|
'converted_generic_org_type',
|
||||||
"cisa_representative_last_name",
|
'converted_federal_agency',
|
||||||
"cisa_representative_email",
|
'creator',
|
||||||
|
'about_your_organization',
|
||||||
|
'requested_domain',
|
||||||
|
'approved_domain',
|
||||||
|
'alternative_domains',
|
||||||
|
'purpose',
|
||||||
|
'no_other_contacts_rationale',
|
||||||
|
'anything_else',
|
||||||
|
'is_policy_acknowledged',
|
||||||
|
'cisa_representative_first_name',
|
||||||
|
'cisa_representative_last_name',
|
||||||
|
'cisa_representative_email'
|
||||||
]
|
]
|
||||||
|
|
||||||
self.assertEqual(readonly_fields, expected_fields)
|
self.assertEqual(readonly_fields, expected_fields)
|
||||||
|
|
||||||
def test_readonly_fields_for_superuser(self):
|
def test_readonly_fields_for_superuser(self):
|
||||||
|
@ -1722,6 +1744,17 @@ class TestDomainRequestAdmin(MockEppLib):
|
||||||
"alternative_domains",
|
"alternative_domains",
|
||||||
"is_election_board",
|
"is_election_board",
|
||||||
"status_history",
|
"status_history",
|
||||||
|
"converted_senior_official",
|
||||||
|
"converted_federal_type",
|
||||||
|
"converted_federal_agency",
|
||||||
|
"converted_state_territory",
|
||||||
|
"converted_organization_name",
|
||||||
|
"converted_address_line1",
|
||||||
|
"converted_address_line2",
|
||||||
|
"converted_zipcode",
|
||||||
|
"converted_urbanization",
|
||||||
|
"converted_city",
|
||||||
|
"converted_generic_org_type"
|
||||||
]
|
]
|
||||||
|
|
||||||
self.assertEqual(readonly_fields, expected_fields)
|
self.assertEqual(readonly_fields, expected_fields)
|
||||||
|
@ -2129,6 +2162,7 @@ class TestDomainRequestAdmin(MockEppLib):
|
||||||
response_content = "".join(response.content.decode().split())
|
response_content = "".join(response.content.decode().split())
|
||||||
|
|
||||||
# Check if response contains expected_html
|
# Check if response contains expected_html
|
||||||
|
print(response.content.decode("utf-8"))
|
||||||
self.assertIn(expected_html, response_content)
|
self.assertIn(expected_html, response_content)
|
||||||
|
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue