This commit is contained in:
David Kennedy 2024-09-20 12:38:29 -04:00
parent 410bdc8238
commit e4df5c83a4
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B

View file

@ -2444,7 +2444,7 @@ class DomainInformationInline(admin.StackedInline):
return super().formfield_for_foreignkey(db_field, request, **kwargs) return super().formfield_for_foreignkey(db_field, request, **kwargs)
def get_readonly_fields(self, request, obj=None): def get_readonly_fields(self, request, obj=None):
readonly_fields = copy.deepcopy(DomainInformationAdmin.get_readonly_fields(self, request, obj=None)) readonly_fields = copy.deepcopy(DomainInformationAdmin.get_readonly_fields(self, request, obj=None))
readonly_fields.extend(["domain_managers", "invited_domain_managers"]) # type: ignore readonly_fields.extend(["domain_managers", "invited_domain_managers"]) # type: ignore
return readonly_fields return readonly_fields
@ -2461,13 +2461,19 @@ class DomainInformationInline(admin.StackedInline):
for index, (title, f) in enumerate(modified_fieldsets): for index, (title, f) in enumerate(modified_fieldsets):
if title is None: if title is None:
modified_fieldsets[index][1]["fields"] = [ modified_fieldsets[index][1]["fields"] = [
field for field in modified_fieldsets[index][1]["fields"] if field not in ["creator", "domain_request", "notes"] field
for field in modified_fieldsets[index][1]["fields"]
if field not in ["creator", "domain_request", "notes"]
] ]
elif title == "Contacts": elif title == "Contacts":
modified_fieldsets[index][1]["fields"] = [ modified_fieldsets[index][1]["fields"] = [
field for field in modified_fieldsets[index][1]["fields"] if field not in ["other_contacts", "no_other_contacts_rationale"] field
for field in modified_fieldsets[index][1]["fields"]
if field not in ["other_contacts", "no_other_contacts_rationale"]
] ]
modified_fieldsets[index][1]["fields"].extend(["domain_managers", "invited_domain_managers"]) # type: ignore modified_fieldsets[index][1]["fields"].extend(
["domain_managers", "invited_domain_managers"]
) # type: ignore
# Remove or remove fieldset sections # Remove or remove fieldset sections
for index, (title, f) in enumerate(modified_fieldsets): for index, (title, f) in enumerate(modified_fieldsets):
@ -2478,7 +2484,7 @@ class DomainInformationInline(admin.StackedInline):
# move Background info to the bottom of the list # move Background info to the bottom of the list
fieldsets_to_move = modified_fieldsets.pop(index) fieldsets_to_move = modified_fieldsets.pop(index)
modified_fieldsets.append(fieldsets_to_move) modified_fieldsets.append(fieldsets_to_move)
return modified_fieldsets return modified_fieldsets