mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-28 13:36:30 +02:00
Organization name now links to portfolio if portfolio is present
This commit is contained in:
parent
579ae02960
commit
e528a277f1
1 changed files with 34 additions and 24 deletions
|
@ -1823,6 +1823,16 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
|||
|
||||
@admin.display(description=_("Organization Name"))
|
||||
def converted_organization_name(self, obj):
|
||||
# Example: Show different icons based on `status`
|
||||
if obj.portfolio:
|
||||
url = reverse("admin:registrar_portfolio_changelist") + f"{obj.portfolio.id}"
|
||||
text = obj.converted_organization_name
|
||||
return format_html(
|
||||
'<a href="{}">{}</a>',
|
||||
url,
|
||||
text
|
||||
)
|
||||
else:
|
||||
return obj.converted_organization_name
|
||||
|
||||
@admin.display(description=_("Federal Agency"))
|
||||
|
@ -1841,28 +1851,6 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
|||
def converted_state_territory(self, obj):
|
||||
return obj.converted_state_territory
|
||||
|
||||
# Columns
|
||||
list_display = [
|
||||
"requested_domain",
|
||||
"first_submitted_date",
|
||||
"last_submitted_date",
|
||||
"last_status_update",
|
||||
"status",
|
||||
"custom_election_board",
|
||||
"converted_generic_org_type",
|
||||
"converted_organization_name",
|
||||
"converted_federal_agency",
|
||||
"converted_federal_type",
|
||||
"converted_city",
|
||||
"converted_state_territory",
|
||||
"investigator",
|
||||
]
|
||||
|
||||
orderable_fk_fields = [
|
||||
("requested_domain", "name"),
|
||||
("investigator", ["first_name", "last_name"]),
|
||||
]
|
||||
|
||||
def custom_election_board(self, obj):
|
||||
return "Yes" if obj.is_election_board else "No"
|
||||
|
||||
|
@ -1938,7 +1926,29 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
|||
def status_history(self, obj):
|
||||
return "No changelog to display."
|
||||
|
||||
status_history.short_description = "Status History" # type: ignore
|
||||
status_history.short_description = "Status history" # type: ignore
|
||||
|
||||
# Columns
|
||||
list_display = [
|
||||
"requested_domain",
|
||||
"first_submitted_date",
|
||||
"last_submitted_date",
|
||||
"last_status_update",
|
||||
"status",
|
||||
"custom_election_board",
|
||||
"converted_generic_org_type",
|
||||
"converted_organization_name",
|
||||
"converted_federal_agency",
|
||||
"converted_federal_type",
|
||||
"converted_city",
|
||||
"converted_state_territory",
|
||||
"investigator",
|
||||
]
|
||||
|
||||
orderable_fk_fields = [
|
||||
("requested_domain", "name"),
|
||||
("investigator", ["first_name", "last_name"]),
|
||||
]
|
||||
|
||||
# Filters
|
||||
list_filter = (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue