Mobile API Changes for the Events and event images

This commit is contained in:
Vivek P Prakash
2025-12-02 02:59:41 +05:30
parent b2a2324c66
commit d1ca2f9891
2 changed files with 8 additions and 2 deletions

View File

@@ -48,3 +48,5 @@ class EventImages(models.Model):
def __str__(self):
return f"{self.event_image}"

View File

@@ -90,8 +90,12 @@ class EventListAPI(APIView):
print('*' * 10)
print(e.id)
print('*' * 10)
thumb_img = EventImages.objects.get(event=e.id, is_primary=True)
data_dict['thumb_img'] = request.build_absolute_uri(thumb_img.event_image.url)
try:
thumb_img = EventImages.objects.get(event=e.id, is_primary=True)
data_dict['thumb_img'] = request.build_absolute_uri(thumb_img.event_image.url)
except EventImages.DoesNotExist:
data_dict['thumb_img'] = ''
event_list.append(data_dict)
return JsonResponse({