mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-30 06:26:34 +02:00
add new fields to admin and refactor a bit
This commit is contained in:
parent
4c089ff904
commit
61c32351dd
5 changed files with 104 additions and 22 deletions
|
@ -2535,6 +2535,40 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
|||
|
||||
portfolio_urbanization.short_description = "Urbanization" # type: ignore
|
||||
|
||||
# ------ FEB fields ------
|
||||
def feb_naming_requirements_details(self, obj):
|
||||
return obj.feb_naming_requirements_details if obj.feb_naming_requirements else ""
|
||||
|
||||
feb_naming_requirements_details.short_description = "Domain Name Rationale:" # type: ignore
|
||||
|
||||
def feb_purpose_choice(self, obj):
|
||||
return obj.feb_purpose_choice if obj.feb_purpose_choice else ""
|
||||
|
||||
feb_purpose_choice.short_description = "Purpose type:" # type: ignore
|
||||
|
||||
def time_frame_details(self, obj):
|
||||
return obj.time_frame_details if obj.has_timeframe else ""
|
||||
|
||||
time_frame_details.short_description = "Target time frame:" # type: ignore
|
||||
|
||||
def interagency_initiative_details(self, obj):
|
||||
return obj.interagency_initiative_details if obj.is_interagency_initiative else ""
|
||||
|
||||
interagency_initiative_details.short_description = "Interagency Initiative:" # type: ignore
|
||||
|
||||
def eop_stakeholder_first_name(self, obj):
|
||||
return obj.eop_stakeholder_first_name if obj.eop_stakeholder_first_name else ""
|
||||
|
||||
def eop_stakeholder_last_name(self, obj):
|
||||
return obj.eop_stakeholder_last_name if obj.eop_stakeholder_last_name else ""
|
||||
|
||||
def eop_stakeholder_email(self, obj):
|
||||
return obj.eop_stakeholder_email if obj.eop_stakeholder_email else ""
|
||||
|
||||
eop_stakeholder_first_name.short_description = "EOP Stakeholder First Name" # type: ignore
|
||||
eop_stakeholder_last_name.short_description = "EOP Stakeholder Last Name" # type: ignore
|
||||
eop_stakeholder_email.short_description = "EOP Stakeholder Email" # type: ignore
|
||||
|
||||
# This is just a placeholder. This field will be populated in the detail_table_fieldset view.
|
||||
# This is not a field that exists on the model.
|
||||
def status_history(self, obj):
|
||||
|
@ -2615,7 +2649,16 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
|||
]
|
||||
},
|
||||
),
|
||||
(".gov domain", {"fields": ["requested_domain", "alternative_domains"]}),
|
||||
(
|
||||
".gov domain",
|
||||
{
|
||||
"fields": [
|
||||
"requested_domain",
|
||||
"alternative_domains",
|
||||
"feb_naming_requirements_details",
|
||||
]
|
||||
},
|
||||
),
|
||||
(
|
||||
"Contacts",
|
||||
{
|
||||
|
@ -2627,10 +2670,25 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
|||
"cisa_representative_first_name",
|
||||
"cisa_representative_last_name",
|
||||
"cisa_representative_email",
|
||||
"eop_stakeholder_first_name",
|
||||
"eop_stakeholder_last_name",
|
||||
"eop_stakeholder_email",
|
||||
]
|
||||
},
|
||||
),
|
||||
(
|
||||
"Background info",
|
||||
{
|
||||
"fields": [
|
||||
"feb_purpose_choice",
|
||||
"purpose",
|
||||
"time_frame_details",
|
||||
"interagency_initiative_details",
|
||||
"anything_else",
|
||||
"current_websites",
|
||||
]
|
||||
},
|
||||
),
|
||||
("Background info", {"fields": ["purpose", "anything_else", "current_websites"]}),
|
||||
(
|
||||
"Type of organization",
|
||||
{
|
||||
|
@ -2781,6 +2839,20 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
|||
"suborganization_city",
|
||||
"suborganization_state_territory",
|
||||
]
|
||||
# Hide FEB fields behind the organization requests flag
|
||||
# and only show them if the portfolio is executive
|
||||
if not (obj and obj.portfolio and obj.portfolio.federal_type == BranchChoices.EXECUTIVE):
|
||||
excluded_fields.extend([
|
||||
"feb_naming_requirements_details",
|
||||
"feb_purpose_choice",
|
||||
"time_frame_details",
|
||||
"interagency_initiative_details",
|
||||
"eop_stakeholder_first_name",
|
||||
"eop_stakeholder_last_name",
|
||||
"eop_stakeholder_email",
|
||||
])
|
||||
# This makes .gov domain collapsable underneath Requested By
|
||||
fieldsets[2][1]["classes"] = ["collapse--dgfieldset"]
|
||||
modified_fieldsets = []
|
||||
for name, data in fieldsets:
|
||||
fields = data.get("fields", [])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue