Merge branch 'ms/3458-FEB-admin' into cb/3212-subissues

This commit is contained in:
matthewswspence 2025-03-25 11:57:35 -05:00
commit 3656b19828
No known key found for this signature in database
GPG key ID: FB458202A7852BA4
2 changed files with 79 additions and 3 deletions

View file

@ -2733,6 +2733,40 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportRegistrarModelAdmin):
portfolio_urbanization.short_description = "Urbanization" # type: ignore 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 just a placeholder. This field will be populated in the detail_table_fieldset view.
# This is not a field that exists on the model. # This is not a field that exists on the model.
def status_history(self, obj): def status_history(self, obj):
@ -2813,7 +2847,16 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportRegistrarModelAdmin):
] ]
}, },
), ),
(".gov domain", {"fields": ["requested_domain", "alternative_domains"]}), (
".gov domain",
{
"fields": [
"requested_domain",
"alternative_domains",
"feb_naming_requirements_details",
]
},
),
( (
"Contacts", "Contacts",
{ {
@ -2825,10 +2868,25 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportRegistrarModelAdmin):
"cisa_representative_first_name", "cisa_representative_first_name",
"cisa_representative_last_name", "cisa_representative_last_name",
"cisa_representative_email", "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", "Type of organization",
{ {
@ -3035,6 +3093,20 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportRegistrarModelAdmin):
"suborganization_city", "suborganization_city",
"suborganization_state_territory", "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 = [] modified_fieldsets = []
for name, data in fieldsets: for name, data in fieldsets:
fields = data.get("fields", []) fields = data.get("fields", [])

View file

@ -515,12 +515,15 @@ class DomainRequest(TimeStampedModel):
feb_naming_requirements_details = models.TextField( feb_naming_requirements_details = models.TextField(
null=True, null=True,
blank=True, blank=True,
help_text="Required if requested domain that doesn't meet naming requirements",
verbose_name="Domain name rationale",
) )
feb_purpose_choice = models.CharField( feb_purpose_choice = models.CharField(
null=True, null=True,
blank=True, blank=True,
choices=FEBPurposeChoices.choices, choices=FEBPurposeChoices.choices,
verbose_name="Purpose type",
) )
working_with_eop = models.BooleanField( working_with_eop = models.BooleanField(
@ -548,7 +551,6 @@ class DomainRequest(TimeStampedModel):
# This field is alternately used for generic domain purpose explanations # This field is alternately used for generic domain purpose explanations
# and for explanations of the specific purpose chosen with feb_purpose_choice # and for explanations of the specific purpose chosen with feb_purpose_choice
# by a Federal Executive Branch agency.
purpose = models.TextField( purpose = models.TextField(
null=True, null=True,
blank=True, blank=True,
@ -562,6 +564,7 @@ class DomainRequest(TimeStampedModel):
time_frame_details = models.TextField( time_frame_details = models.TextField(
null=True, null=True,
blank=True, blank=True,
verbose_name="Target time frame",
) )
is_interagency_initiative = models.BooleanField( is_interagency_initiative = models.BooleanField(
@ -572,6 +575,7 @@ class DomainRequest(TimeStampedModel):
interagency_initiative_details = models.TextField( interagency_initiative_details = models.TextField(
null=True, null=True,
blank=True, blank=True,
verbose_name="Interagency initiative",
) )
alternative_domains = models.ManyToManyField( alternative_domains = models.ManyToManyField(