This commit is contained in:
zandercymatics 2024-09-30 09:08:01 -06:00
parent df3f37bf40
commit 7602629dc5
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
3 changed files with 51 additions and 42 deletions

View file

@ -20,7 +20,11 @@ from epplibwrapper.errors import ErrorCode, RegistryError
from registrar.models.user_domain_role import UserDomainRole
from waffle.admin import FlagAdmin
from waffle.models import Sample, Switch
from registrar.utility.admin_helpers import get_all_action_needed_reason_emails, get_action_needed_reason_default_email, get_field_links_as_list
from registrar.utility.admin_helpers import (
get_all_action_needed_reason_emails,
get_action_needed_reason_default_email,
get_field_links_as_list,
)
from registrar.models import Contact, Domain, DomainRequest, DraftDomain, User, Website, SeniorOfficial
from registrar.utility.constants import BranchChoices
from registrar.utility.errors import FSMDomainRequestError, FSMErrorCodes

View file

@ -335,6 +335,7 @@ def get_url_name(path):
logger.error(f"No matching URL name found for path: {path}")
return None
def value_of_attribute(obj, attribute_name: str):
"""Returns the value of getattr if the attribute isn't callable.
If it is, execute the underlying function and return that result instead."""

View file

@ -41,8 +41,13 @@ def get_action_needed_reason_default_email(request, domain_request, action_neede
def get_field_links_as_list(
queryset, model_name, attribute_name=None, link_info_attribute=None, separator=None, msg_for_none="-",
):
queryset,
model_name,
attribute_name=None,
link_info_attribute=None,
separator=None,
msg_for_none="-",
):
"""
Generate HTML links for items in a queryset, using a specified attribute for link text.
@ -86,4 +91,3 @@ def get_field_links_as_list(
else:
links = "".join(links)
return format_html(f'<ul class="add-list-reset">{links}</ul>') if links else msg_for_none