This commit is contained in:
CocoByte 2024-11-24 22:01:02 -07:00
parent ba06660df0
commit 503d214ca2
No known key found for this signature in database
GPG key ID: BBFAA2526384C97F
2 changed files with 36 additions and 34 deletions

View file

@ -1543,7 +1543,7 @@ class DomainInformationAdmin(ListHeaderAdmin, ImportExportModelAdmin):
form = DomainInformationAdminForm form = DomainInformationAdminForm
# Customize column header text # Customize column header text
@admin.display(description=_("Converted Generic Org Type")) @admin.display(description=_("Generic Org Type"))
def converted_generic_org_type(self, obj): def converted_generic_org_type(self, obj):
return obj.converted_generic_org_type return obj.converted_generic_org_type
@ -1709,18 +1709,18 @@ class DomainRequestResource(FsmModelResource):
# Override exports for these columns in DomainInformation to use converted values. These values # Override exports for these columns in DomainInformation to use converted values. These values
# come from @Property functions, which are not automatically included in the export and which we # come from @Property functions, which are not automatically included in the export and which we
# want to use in place of the native fields. # want to use in place of the native fields.
organization_name = fields.Field(attribute='converted_organization_name', column_name='GEN organization_name') organization_name = fields.Field(attribute='converted_organization_name', column_name='organization_name')
generic_org_type = fields.Field(attribute='converted_generic_org_type', column_name='GEN generic_org_type') generic_org_type = fields.Field(attribute='converted_generic_org_type', column_name='generic_org_type')
federal_type = fields.Field(attribute='converted_federal_type', column_name='GEN federal_type') federal_type = fields.Field(attribute='converted_federal_type', column_name='federal_type')
federal_agency = fields.Field(attribute='converted_federal_agency', column_name='GEN federal_agency') federal_agency = fields.Field(attribute='converted_federal_agency', column_name='federal_agency')
senior_official = fields.Field(attribute='converted_senior_official', column_name='GEN senior_official') senior_official = fields.Field(attribute='converted_senior_official', column_name='senior_official')
address_line1 = fields.Field(attribute='converted_address_line1', column_name='GEN address_line1') address_line1 = fields.Field(attribute='converted_address_line1', column_name='address_line1')
address_line2 = fields.Field(attribute='converted_address_line2', column_name='GEN address_line2') address_line2 = fields.Field(attribute='converted_address_line2', column_name='address_line2')
city = fields.Field(attribute='converted_city', column_name='GEN city') city = fields.Field(attribute='converted_city', column_name='city')
state_territory = fields.Field(attribute='converted_state_territory', column_name='GEN state_territory') state_territory = fields.Field(attribute='converted_state_territory', column_name='state_territory')
zipcode = fields.Field(attribute='converted_zipcode', column_name='GEN zipcode') zipcode = fields.Field(attribute='converted_zipcode', column_name='zipcode')
urbanization = fields.Field(attribute='converted_urbanization', column_name='GEN urbanization') urbanization = fields.Field(attribute='converted_urbanization', column_name='urbanization')
senior_official = fields.Field(attribute='converted_urbanization', column_name='GEN senior official') senior_official = fields.Field(attribute='converted_urbanization', column_name='senior official')
# Custom getters for the above columns that map to @property functions instead of fields # Custom getters for the above columns that map to @property functions instead of fields
def dehydrate_organization_name(self, obj): def dehydrate_organization_name(self, obj):
@ -2698,14 +2698,11 @@ class DomainResource(FsmModelResource):
) )
# Custom getters to retrieve the values from @Proprerty methods in DomainInfo # Custom getters to retrieve the values from @Proprerty methods in DomainInfo
converted_generic_org_type = fields.Field(attribute='converted_generic_org_type', column_name='Converted generic org type') converted_generic_org_type = fields.Field(attribute='converted_generic_org_type', column_name='generic org type')
converted_federal_agency = fields.Field(attribute='converted_federal_agency', column_name='Converted federal agency') converted_federal_agency = fields.Field(attribute='converted_federal_agency', column_name='federal agency')
converted_organization_name = fields.Field(attribute='converted_organization_name', column_name='Converted organization name') converted_organization_name = fields.Field(attribute='converted_organization_name', column_name='organization name')
converted_city = fields.Field(attribute='converted_city', column_name='city') converted_city = fields.Field(attribute='converted_city', column_name='city')
converted_state_territory = fields.Field(attribute='converted_state_territory', column_name='Converted state territory') converted_state_territory = fields.Field(attribute='converted_state_territory', column_name='state territory')
# def dehydrate_generic_org_type(self, obj):
# return obj.domain_info.converted_federal_type
def dehydrate_converted_generic_org_type(self, obj): def dehydrate_converted_generic_org_type(self, obj):
return obj.domain_info.converted_generic_org_type return obj.domain_info.converted_generic_org_type
@ -2852,67 +2849,72 @@ class DomainAdmin(ListHeaderAdmin, ImportExportModelAdmin):
# ------- Domain Information Fields # ------- Domain Information Fields
# --- Generic Org Type # --- Generic Org Type
@admin.display(description=_("Converted Generic Org Type")) # Use converted value in the table
@admin.display(description=_("Generic Org Type"))
def converted_generic_org_type(self, obj): def converted_generic_org_type(self, obj):
return obj.domain_info.converted_generic_org_type return obj.domain_info.converted_generic_org_type
converted_generic_org_type.admin_order_field = "domain_info__converted_generic_org_type" # type: ignore converted_generic_org_type.admin_order_field = "domain_info__converted_generic_org_type" # type: ignore
# Use native value for the change form
def generic_org_type(self, obj): def generic_org_type(self, obj):
return obj.domain_info.get_generic_org_type_display() return obj.domain_info.get_generic_org_type_display()
# generic_org_type.admin_order_field = "domain_info__generic_org_type" # type: ignore
# --- Federal Agency # --- Federal Agency
@admin.display(description=_("Converted Federal Agency")) @admin.display(description=_("Federal Agency"))
def converted_federal_agency(self, obj): def converted_federal_agency(self, obj):
return obj.domain_info.converted_federal_agency return obj.domain_info.converted_federal_agency
converted_federal_agency.admin_order_field = "domain_info__converted_federal_agency" # type: ignore converted_federal_agency.admin_order_field = "domain_info__converted_federal_agency" # type: ignore
# Use native value for the change form
def federal_agency(self, obj): def federal_agency(self, obj):
if obj.domain_info: if obj.domain_info:
return obj.domain_info.federal_agency return obj.domain_info.federal_agency
else: else:
return None return None
# federal_agency.admin_order_field = "domain_info__federal_agency" # type: ignore
# --- Federal Type # --- Federal Type
@admin.display(description=_("Converted Federal Type")) # Use converted value in the table
@admin.display(description=_("Federal Type"))
def converted_federal_type(self, obj): def converted_federal_type(self, obj):
return obj.domain_info.converted_federal_type return obj.domain_info.converted_federal_type
converted_federal_type.admin_order_field = "domain_info__converted_federal_type" # type: ignore converted_federal_type.admin_order_field = "domain_info__converted_federal_type" # type: ignore
# Use native value for the change form
def federal_type(self, obj): def federal_type(self, obj):
return obj.domain_info.federal_type if obj.domain_info else None return obj.domain_info.federal_type if obj.domain_info else None
# federal_type.admin_order_field = "domain_info__federal_type" # type: ignore
# --- Organization Name # --- Organization Name
@admin.display(description=_("Converted Organization Name")) # Use converted value in the table
@admin.display(description=_("Organization Name"))
def converted_organization_name(self, obj): def converted_organization_name(self, obj):
return obj.domain_info.converted_organization_name return obj.domain_info.converted_organization_name
converted_organization_name.admin_order_field = "domain_info__converted_organization_name" # type: ignore converted_organization_name.admin_order_field = "domain_info__converted_organization_name" # type: ignore
# Use native value for the change form
def organization_name(self, obj): def organization_name(self, obj):
return obj.domain_info.organization_name if obj.domain_info else None return obj.domain_info.organization_name if obj.domain_info else None
# organization_name.admin_order_field = "domain_info__organization_name" # type: ignore
# --- City # --- City
@admin.display(description=_("Converted City")) # Use converted value in the table
@admin.display(description=_("City"))
def converted_city(self, obj): def converted_city(self, obj):
return obj.domain_info.converted_city return obj.domain_info.converted_city
converted_city.admin_order_field = "domain_info__converted_city" # type: ignore converted_city.admin_order_field = "domain_info__converted_city" # type: ignore
# Use native value for the change form
def city(self, obj): def city(self, obj):
return obj.domain_info.city if obj.domain_info else None return obj.domain_info.city if obj.domain_info else None
# city.admin_order_field = "domain_info__city" # type: ignore
# --- State # --- State
@admin.display(description=_("Converted State / territory")) # Use converted value in the table
@admin.display(description=_("State / territory"))
def converted_state_territory(self, obj): def converted_state_territory(self, obj):
return obj.domain_info.converted_state_territory return obj.domain_info.converted_state_territory
converted_state_territory.admin_order_field = "domain_info__converted_state_territory" # type: ignore converted_state_territory.admin_order_field = "domain_info__converted_state_territory" # type: ignore
# Use native value for the change form
def state_territory(self, obj): def state_territory(self, obj):
return obj.domain_info.state_territory if obj.domain_info else None return obj.domain_info.state_territory if obj.domain_info else None
# state_territory.admin_order_field = "domain_info__state_territory" # type: ignore
def dnssecdata(self, obj): def dnssecdata(self, obj):

View file

@ -431,8 +431,8 @@ class DomainInformation(TimeStampedModel):
@property @property
def converted_organization_name(self): def converted_organization_name(self):
if self.portfolio: if self.portfolio:
return "portoflio name" #self.portfolio.organization_name return self.portfolio.organization_name
return "self name" #self.organization_name return self.organization_name
@property @property
def converted_generic_org_type(self): def converted_generic_org_type(self):