Update portfolio.py

This commit is contained in:
zandercymatics 2024-08-09 10:24:45 -06:00
parent 0218da50d8
commit 956e27cc77
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7

View file

@ -76,30 +76,15 @@ class PortfolioSeniorOfficialForm(forms.ModelForm):
"""
JOIN = "senior_official"
full_name = forms.CharField(label="Full name", required=False)
full_name = forms.CharField(label="Full name")
class Meta:
model = SeniorOfficial
fields = [
"first_name",
"last_name",
"title",
"email",
]
widgets = {
# We need to set the required attributed for State/territory
# because for this fields we are creating an individual
# instance of the Select. For the other fields we use the for loop to set
# the class's required attribute to true.
"first_name": forms.TextInput,
"last_name": forms.TextInput,
"title": forms.TextInput,
"email": forms.TextInput,
"full_name": forms.TextInput(attrs={"readonly": "readonly"})
}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if self.instance:
self.fields["full_name"].initial = self.instance.get_formatted_name()