mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-28 21:46:33 +02:00
Fix bug with senior_official in django admin, add readonly
This commit is contained in:
parent
3e992f9ec8
commit
2863e29d96
3 changed files with 5 additions and 4 deletions
|
@ -504,8 +504,6 @@ class AdminSortFields:
|
||||||
# == Contact == #
|
# == Contact == #
|
||||||
"other_contacts": (Contact, _name_sort),
|
"other_contacts": (Contact, _name_sort),
|
||||||
"submitter": (Contact, _name_sort),
|
"submitter": (Contact, _name_sort),
|
||||||
# == Senior Official == #
|
|
||||||
"senior_official": (SeniorOfficial, _name_sort),
|
|
||||||
# == User == #
|
# == User == #
|
||||||
"creator": (User, _name_sort),
|
"creator": (User, _name_sort),
|
||||||
"user": (User, _name_sort),
|
"user": (User, _name_sort),
|
||||||
|
|
|
@ -321,9 +321,12 @@ class SeniorOfficialContactForm(ContactForm):
|
||||||
"""Form for updating senior official contacts."""
|
"""Form for updating senior official contacts."""
|
||||||
|
|
||||||
JOIN = "senior_official"
|
JOIN = "senior_official"
|
||||||
|
full_name = forms.CharField(label="Full name", required=False)
|
||||||
def __init__(self, disable_fields=False, *args, **kwargs):
|
def __init__(self, disable_fields=False, *args, **kwargs):
|
||||||
super().__init__(*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
|
# Overriding bc phone not required in this form
|
||||||
self.fields["phone"] = forms.IntegerField(required=False)
|
self.fields["phone"] = forms.IntegerField(required=False)
|
||||||
|
|
|
@ -76,7 +76,7 @@ class PortfolioSeniorOfficialForm(forms.ModelForm):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
JOIN = "senior_official"
|
JOIN = "senior_official"
|
||||||
full_name = forms.CharField(label="Full name")
|
full_name = forms.CharField(label="Full name", required=False)
|
||||||
class Meta:
|
class Meta:
|
||||||
model = SeniorOfficial
|
model = SeniorOfficial
|
||||||
fields = [
|
fields = [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue