Initial draft

This commit is contained in:
CocoByte 2024-11-01 17:37:44 -06:00
parent edfc67649d
commit 9f9147e661
No known key found for this signature in database
GPG key ID: BBFAA2526384C97F
3 changed files with 23 additions and 5 deletions

View file

@ -1461,10 +1461,15 @@ class DomainInformationAdmin(ListHeaderAdmin, ImportExportModelAdmin):
form = DomainInformationAdminForm form = DomainInformationAdminForm
# Customize column header text
@admin.display(description=_("Generic Org Type"))
def converted_generic_org_type(self, obj):
return obj.converted_generic_org_type
# Columns # Columns
list_display = [ list_display = [
"domain", "domain",
"generic_org_type", "converted_generic_org_type",
"created_at", "created_at",
] ]
@ -1493,7 +1498,7 @@ class DomainInformationAdmin(ListHeaderAdmin, ImportExportModelAdmin):
}, },
), ),
(".gov domain", {"fields": ["domain"]}), (".gov domain", {"fields": ["domain"]}),
("Contacts", {"fields": ["senior_official", "other_contacts", "no_other_contacts_rationale"]}), ("Contacts", {"fields": ["generic_org_type", "other_contacts", "no_other_contacts_rationale"]}),
("Background info", {"fields": ["anything_else"]}), ("Background info", {"fields": ["anything_else"]}),
( (
"Type of organization", "Type of organization",
@ -1612,6 +1617,12 @@ class DomainInformationAdmin(ListHeaderAdmin, ImportExportModelAdmin):
use_sort = db_field.name != "senior_official" use_sort = db_field.name != "senior_official"
return super().formfield_for_foreignkey(db_field, request, use_admin_sort_fields=use_sort, **kwargs) return super().formfield_for_foreignkey(db_field, request, use_admin_sort_fields=use_sort, **kwargs)
def get_queryset(self, request):
qs = super().get_queryset(request)
return qs.annotate(
converted_generic_org_type_display="hey"
)
class DomainRequestResource(FsmModelResource): class DomainRequestResource(FsmModelResource):
"""defines how each field in the referenced model should be mapped to the corresponding fields in the """defines how each field in the referenced model should be mapped to the corresponding fields in the

View file

@ -426,13 +426,14 @@ class DomainInformation(TimeStampedModel):
else: else:
return None return None
# ----- Portfolio Properties -----
@property @property
def converted_organization_name(self): def converted_organization_name(self):
if self.portfolio: if self.portfolio:
return self.portfolio.organization_name return self.portfolio.organization_name
return self.organization_name return self.organization_name
# ----- Portfolio Properties -----
@property @property
def converted_generic_org_type(self): def converted_generic_org_type(self):
if self.portfolio: if self.portfolio:
@ -492,3 +493,9 @@ class DomainInformation(TimeStampedModel):
if self.portfolio: if self.portfolio:
return self.portfolio.urbanization return self.portfolio.urbanization
return self.urbanization return self.urbanization