review fixes

This commit is contained in:
matthewswspence 2025-03-26 11:17:21 -05:00
parent bffd8e2090
commit 968a68f248
No known key found for this signature in database
GPG key ID: FB458202A7852BA4
5 changed files with 15 additions and 35 deletions

View file

@ -2737,23 +2737,15 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportRegistrarModelAdmin):
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 ""
@ -2763,10 +2755,6 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportRegistrarModelAdmin):
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):
@ -3107,8 +3095,6 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportRegistrarModelAdmin):
"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", [])

View file

@ -55,19 +55,17 @@ class DomainRequest(TimeStampedModel):
return cls(status_name).label if status_name else None
class FEBPurposeChoices(models.TextChoices):
WEBSITE = "website"
REDIRECT = "redirect"
OTHER = "other"
WEBSITE = "website", "Used for a new website"
REDIRECT = "redirect", "Used as a redirect for an existing website"
OTHER = "other", "Not for a website"
@classmethod
def get_purpose_label(cls, purpose_name: str):
"""Returns the associated label for a given purpose name"""
if purpose_name == cls.WEBSITE:
return "Used for a new website"
elif purpose_name == cls.REDIRECT:
return "Used as a redirect for an existing website"
else:
return "Not for a website"
logger.debug(f"purpose_name: {purpose_name}")
logger.debug(f"label: {cls(purpose_name).label}")
return cls(purpose_name).label if purpose_name else None
class StateTerritoryChoices(models.TextChoices):
ALABAMA = "AL", "Alabama (AL)"
@ -520,6 +518,7 @@ class DomainRequest(TimeStampedModel):
feb_naming_requirements = models.BooleanField(
null=True,
blank=True,
verbose_name="Meets Naming Requirements",
)
feb_naming_requirements_details = models.TextField(
@ -1030,12 +1029,14 @@ class DomainRequest(TimeStampedModel):
has_organization_feature_flag = flag_is_active_for_user(recipient, "organization_feature")
is_org_user = has_organization_feature_flag and recipient.has_view_portfolio_permission(self.portfolio)
requires_feb_questions = self.is_feb() and is_org_user
purpose_label = DomainRequest.FEBPurposeChoices.get_purpose_label(self.purpose)
context = {
"domain_request": self,
# This is the user that we refer to in the email
"recipient": recipient,
"is_org_user": is_org_user,
"requires_feb_questions": requires_feb_questions,
"purpose_label": purpose_label,
}
if custom_email_content:

View file

@ -23,7 +23,7 @@ Alternative domains:
{% endfor %}{% endif %}
Purpose of your domain:
{% if requires_feb_questions %}
{{ domain_request.feb_purpose_choice }}
{{ purpose_label }}
{{ domain_request.purpose }}
Target time frame:
{% if domain_request.has_target_time_frame %}

View file

@ -72,14 +72,8 @@
{% endwith %}
{% if requires_feb_questions %}
<h4 class="margin-bottom-0">Purpose</h4>
{% if domain_request.feb_purpose_choice == "website" %}
<p class="margin-y-0">Used for a new website</p>
<p class="margin-y-0">{{domain_request.purpose}}</p>
{% elif domain_request.feb_purpose_choice == "redirect" %}
<p class="margin-y-0">Used as a redirect for an existing website</p>
<p class="margin-y-0">{{domain_request.purpose}}</p>
{% elif domain_request.feb_purpose_choice == "other" %}
<p class="margin-y-0">Not for a website</p>
{% if domain_request.feb_purpose_choice %}
<p class="margin-y-0">{{purpose_label}}</p>
<p class="margin-y-0">{{domain_request.purpose}}</p>
{% else %}
<p class="margin-y-0"><span class='text-bold text-secondary-dark'>Incomplete</span></p>

View file

@ -1178,11 +1178,10 @@ class PortfolioDomainRequestStatusViewOnly(DetailView):
context["Step"] = PortfolioDomainRequestStep.__members__
context["steps"] = request_step_list(wizard, PortfolioDomainRequestStep)
context["form_titles"] = wizard.titles
logger.debug(self.object.is_feb())
logger.debug(flag_is_active_for_user(self.request.user, "organization_feature"))
context["requires_feb_questions"] = self.object.is_feb() and flag_is_active_for_user(
self.request.user, "organization_feature"
)
context["purpose_label"] = DomainRequest.FEBPurposeChoices.get_purpose_label(self.object.purpose)
return context