Add comments

This commit is contained in:
zandercymatics 2024-08-14 08:30:55 -06:00
parent 40c52c4691
commit ffb7e146c7
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
4 changed files with 10 additions and 2 deletions

View file

@ -2876,6 +2876,7 @@ class PortfolioAdmin(ListHeaderAdmin):
] ]
def portfolio_type(self, obj: models.Portfolio): def portfolio_type(self, obj: models.Portfolio):
"""Returns the portfolio type, or "-" if the result is empty"""
return obj.portfolio_type if obj.portfolio_type else "-" return obj.portfolio_type if obj.portfolio_type else "-"
portfolio_type.short_description = "Portfolio type" portfolio_type.short_description = "Portfolio type"

View file

@ -2,7 +2,6 @@ from django.db import models
from registrar.models.domain_request import DomainRequest from registrar.models.domain_request import DomainRequest
from registrar.models.federal_agency import FederalAgency from registrar.models.federal_agency import FederalAgency
from registrar.models.utility.portfolio_helper import UserPortfolioRoleChoices
from registrar.utility.constants import BranchChoices from registrar.utility.constants import BranchChoices
from .utility.time_stamped_model import TimeStampedModel from .utility.time_stamped_model import TimeStampedModel
@ -123,6 +122,8 @@ class Portfolio(TimeStampedModel):
@property @property
def portfolio_type(self): def portfolio_type(self):
"""Returns a combination of organization_type and federal_agency,
seperated by ' - '. If no federal_agency is found, we just return the org type."""
org_type = self.OrganizationChoices.get_org_label(self.organization_type) org_type = self.OrganizationChoices.get_org_label(self.organization_type)
if self.organization_type == self.OrganizationChoices.FEDERAL and self.federal_agency: if self.organization_type == self.OrganizationChoices.FEDERAL and self.federal_agency:
return " - ".join([org_type, self.federal_agency.agency]) return " - ".join([org_type, self.federal_agency.agency])

View file

@ -55,6 +55,7 @@ class SeniorOfficial(TimeStampedModel):
return " ".join(names) if names else "Unknown" return " ".join(names) if names else "Unknown"
def has_contact_info(self): def has_contact_info(self):
"""Determines if this user has contact information, such as an email or phone number."""
return bool(self.title or self.email or self.phone) return bool(self.title or self.email or self.phone)
def __str__(self): def __str__(self):

View file

@ -4,7 +4,12 @@
{% block field_sets %} {% block field_sets %}
{% for fieldset in adminform %} {% for fieldset in adminform %}
{% comment %} {% comment %}
This is a placeholder for now This is a placeholder for now.
Disclaimer:
When extending the fieldset view - *make a new one* that extends from detail_table_fieldset.
For instance, "portfolio_fieldset.html".
detail_table_fieldset is used on multiple admin pages, so a change there can have unintended consequences.
{% endcomment %} {% endcomment %}
{% include "django/admin/includes/detail_table_fieldset.html" with original_object=original %} {% include "django/admin/includes/detail_table_fieldset.html" with original_object=original %}
{% endfor %} {% endfor %}