From 63dfd731fc3e4728c0cbd9e77d7191428d8179b3 Mon Sep 17 00:00:00 2001 From: jain Date: Mon, 28 Aug 2023 20:09:39 +0530 Subject: [PATCH] condition in add junior --- junior/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/junior/views.py b/junior/views.py index d7a3d5f..5d23894 100644 --- a/junior/views.py +++ b/junior/views.py @@ -223,7 +223,10 @@ class AddJuniorAPIView(viewsets.ModelViewSet): junior.guardian_code.append(guardian.guardian_code) else: return "Max" - junior.guardian_code_status.append(str(NUMBER['two'])) + if not junior.guardian_code_status: + junior.guardian_code_status = [str(NUMBER['two'])] + else: + junior.guardian_code_status.append(str(NUMBER['two'])) junior.save() jun_data, created = JuniorGuardianRelationship.objects.get_or_create(guardian=guardian, junior=junior) if jun_data: