Skip to content

Commit

Permalink
Revert the form field to being read only
Browse files Browse the repository at this point in the history
  • Loading branch information
CamLamb committed Sep 12, 2023
1 parent 41d92de commit 0858397
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/peoplefinder/forms/profile_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,23 +146,14 @@ class Meta:
"primary_phone_number",
"secondary_phone_number",
]
widgets = {
"email": forms.Select,
}

email = forms.ChoiceField(
label=Person._meta.get_field("email").verbose_name,
help_text=Person._meta.get_field("email").help_text,
required=True,
)

def __init__(self, *args, **kwargs):
self.request_user = kwargs.pop("request_user", None)
super().__init__(*args, **kwargs)

email_label = self.fields["email"].label
self.fields["email"].label = ""
self.fields["email"].choices = [(e, e) for e in self.get_email_choices()]
self.fields["email"].disabled = True

contact_email_label = self.fields["contact_email"].label + " (optional)"
self.fields["contact_email"].label = ""
Expand All @@ -179,7 +170,7 @@ def __init__(self, *args, **kwargs):
self.helper.form_tag = False
self.helper.layout = Layout(
Fieldset(
Field.select("email"),
"email",
legend_size=Size.MEDIUM,
legend=email_label,
),
Expand Down

0 comments on commit 0858397

Please sign in to comment.