Fix bug with senior_official in django admin, add readonly

This commit is contained in:
zandercymatics 2024-08-09 13:40:16 -06:00
parent 3e992f9ec8
commit 2863e29d96
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
3 changed files with 5 additions and 4 deletions

View file

@ -504,8 +504,6 @@ class AdminSortFields:
# == Contact == #
"other_contacts": (Contact, _name_sort),
"submitter": (Contact, _name_sort),
# == Senior Official == #
"senior_official": (SeniorOfficial, _name_sort),
# == User == #
"creator": (User, _name_sort),
"user": (User, _name_sort),

View file

@ -321,10 +321,13 @@ class SeniorOfficialContactForm(ContactForm):
"""Form for updating senior official contacts."""
JOIN = "senior_official"
full_name = forms.CharField(label="Full name", required=False)
def __init__(self, disable_fields=False, *args, **kwargs):
super().__init__(*args, **kwargs)
if self.instance:
self.fields["full_name"].initial = self.instance.get_formatted_name()
# Overriding bc phone not required in this form
self.fields["phone"] = forms.IntegerField(required=False)

View file

@ -76,7 +76,7 @@ class PortfolioSeniorOfficialForm(forms.ModelForm):
"""
JOIN = "senior_official"
full_name = forms.CharField(label="Full name")
full_name = forms.CharField(label="Full name", required=False)
class Meta:
model = SeniorOfficial
fields = [