mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-08-26 06:09:41 +00:00
@ -211,12 +211,12 @@ class AddJuniorAPIView(viewsets.ModelViewSet):
|
|||||||
def associate_guardian(self, user):
|
def associate_guardian(self, user):
|
||||||
junior = Junior.objects.filter(auth__email=self.request.data['email']).first()
|
junior = Junior.objects.filter(auth__email=self.request.data['email']).first()
|
||||||
guardian = Guardian.objects.filter(user=self.request.user).first()
|
guardian = Guardian.objects.filter(user=self.request.user).first()
|
||||||
if junior.guardian_code and ('-' in junior.guardian_code):
|
if junior is None:
|
||||||
junior.guardian_code.remove('-')
|
|
||||||
if not junior:
|
|
||||||
return none
|
return none
|
||||||
if junior.guardian_code and (guardian.guardian_code in junior.guardian_code):
|
if junior.guardian_code and (guardian.guardian_code in junior.guardian_code):
|
||||||
return False
|
return False
|
||||||
|
if junior.guardian_code and ('-' in junior.guardian_code):
|
||||||
|
junior.guardian_code.remove('-')
|
||||||
if not junior.guardian_code:
|
if not junior.guardian_code:
|
||||||
junior.guardian_code = [guardian.guardian_code]
|
junior.guardian_code = [guardian.guardian_code]
|
||||||
elif type(junior.guardian_code) is list and len(junior.guardian_code) < 3:
|
elif type(junior.guardian_code) is list and len(junior.guardian_code) < 3:
|
||||||
|
Reference in New Issue
Block a user