Skip to content

Commit

Permalink
Fix OrganizationForm to also work for Profile
Browse files Browse the repository at this point in the history
  • Loading branch information
jace committed Apr 27, 2020
1 parent 306d672 commit 866ed8b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions funnel/forms/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ class OrganizationForm(forms.Form):
is_public_profile = forms.BooleanField(__("Make profile page public"))

def validate_name(self, field):
if self.edit_obj:
reason = self.edit_obj.validate_name_candidate(field.data)
else:
reason = Profile.validate_name_candidate(field.data)
if field.data and field.data == self.edit_obj.name:
# Don't validate if name is unchanged
return

reason = Profile.validate_name_candidate(field.data)
if not reason:
return # name is available
if reason == 'invalid':
Expand Down

0 comments on commit 866ed8b

Please sign in to comment.