From d24f0751107df1b4421c302e9c2443f21beecd12 Mon Sep 17 00:00:00 2001 From: jain Date: Tue, 29 Aug 2023 21:28:36 +0530 Subject: [PATCH] answer api --- junior/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/junior/views.py b/junior/views.py index 433e410..3e9eeed 100644 --- a/junior/views.py +++ b/junior/views.py @@ -211,12 +211,12 @@ class AddJuniorAPIView(viewsets.ModelViewSet): def associate_guardian(self, user): junior = Junior.objects.filter(auth__email=self.request.data['email']).first() guardian = Guardian.objects.filter(user=self.request.user).first() - if junior.guardian_code and ('-' in junior.guardian_code): - junior.guardian_code.remove('-') - if not junior: + if junior is None: return none if junior.guardian_code and (guardian.guardian_code in junior.guardian_code): return False + if junior.guardian_code and ('-' in junior.guardian_code): + junior.guardian_code.remove('-') if not junior.guardian_code: junior.guardian_code = [guardian.guardian_code] elif type(junior.guardian_code) is list and len(junior.guardian_code) < 3: