Merge pull request #295 from KiwiTechLLC/sprint6-bugs

answer api
This commit is contained in:
gauravmishra-kiwi
2023-08-29 21:32:11 +05:30
committed by GitHub

View File

@ -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: