Skip to content

Commit

Permalink
use already defined query methods instead of custom ones
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepsajan0 committed Jun 26, 2023
1 parent 043c9a1 commit 5f68f86
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions hypha/apply/funds/models/submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,8 @@ def ensure_user_has_account(self):
self.form_data['email'] = self.user.email
self.form_data['full_name'] = self.user.get_full_name()
# Ensure applying user should have applicant role
applicant_group = Group.objects.get(name=APPLICANT_GROUP_NAME)
if applicant_group not in self.user.groups.all():
if not self.user.is_applicant:
applicant_group = Group.objects.get(name=APPLICANT_GROUP_NAME)
self.user.groups.add(applicant_group)
self.user.save()
else:
Expand All @@ -575,8 +575,8 @@ def ensure_user_has_account(self):
defaults={'full_name': full_name}
)
# Ensure applying user should have applicant role
applicant_group = Group.objects.get(name=APPLICANT_GROUP_NAME)
if applicant_group not in self.user.groups.all():
if not self.user.is_applicant:
applicant_group = Group.objects.get(name=APPLICANT_GROUP_NAME)
self.user.groups.add(applicant_group)
self.user.save()
else:
Expand Down

0 comments on commit 5f68f86

Please sign in to comment.