From 5f68f86d68188faebb644a98ef558e302fd330a6 Mon Sep 17 00:00:00 2001 From: sandeepsajan0 Date: Mon, 26 Jun 2023 10:00:46 +0530 Subject: [PATCH] use already defined query methods instead of custom ones --- hypha/apply/funds/models/submissions.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hypha/apply/funds/models/submissions.py b/hypha/apply/funds/models/submissions.py index f76ec671a3..fce185e48a 100644 --- a/hypha/apply/funds/models/submissions.py +++ b/hypha/apply/funds/models/submissions.py @@ -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: @@ -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: