From 70f4f492b8172fb8a03bad5897d094f79a2cdeec Mon Sep 17 00:00:00 2001 From: Adnan Kattekaden Date: Sat, 7 Oct 2023 14:07:52 +0530 Subject: [PATCH] lc lead name issue --- api/dashboard/lc/dash_lc_serializer.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/api/dashboard/lc/dash_lc_serializer.py b/api/dashboard/lc/dash_lc_serializer.py index 60ecbb06..d3ec6910 100644 --- a/api/dashboard/lc/dash_lc_serializer.py +++ b/api/dashboard/lc/dash_lc_serializer.py @@ -340,8 +340,11 @@ class Meta: fields = ['name', 'ig_name', 'member_count', 'members', 'meet_place', 'meet_time', 'lead_name'] def get_lead_name(self, obj): - user = UserCircleLink.objects.filter(circle=obj, accepted=1, lead=True).first().user - return f'{user.first_name} {user.last_name}' + user_circle_link = UserCircleLink.objects.filter(circle=obj, accepted=1, lead=True).first() + if user_circle_link: + user = user_circle_link.user + return f'{user.first_name} {user.last_name}' + return None def get_ig_name(self, obj): return obj.ig.name if obj.ig else None