mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-25 20:18:38 +02:00
Initial draft
This commit is contained in:
parent
edfc67649d
commit
9f9147e661
3 changed files with 23 additions and 5 deletions
|
@ -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",
|
||||||
|
@ -1611,6 +1616,12 @@ class DomainInformationAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
||||||
# objects rather than Contact objects.
|
# objects rather than Contact objects.
|
||||||
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):
|
||||||
|
|
|
@ -2078,4 +2078,4 @@ class Domain(TimeStampedModel, DomainHelper):
|
||||||
if property in self._cache:
|
if property in self._cache:
|
||||||
return self._cache[property]
|
return self._cache[property]
|
||||||
else:
|
else:
|
||||||
raise KeyError("Requested key %s was not found in registry cache." % str(property))
|
raise KeyError("Requested key %s was not found in registry cache." % str(property))
|
|
@ -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:
|
||||||
|
@ -474,7 +475,7 @@ class DomainInformation(TimeStampedModel):
|
||||||
if self.portfolio:
|
if self.portfolio:
|
||||||
return self.portfolio.city
|
return self.portfolio.city
|
||||||
return self.city
|
return self.city
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def converted_state_territory(self):
|
def converted_state_territory(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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue