Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Check for existence of image in image endpoint

Roland Geider75efcd59b504
diff --git a/wger/exercises/api/views.py b/wger/exercises/api/views.py
index 7a1c2d579..c0630e09f 100644
--- a/wger/exercises/api/views.py
+++ b/wger/exercises/api/views.py
@@ -158,7 +158,11 @@ class ExerciseImageViewSet(viewsets.ModelViewSet):
'''
Return a list of the image's thumbnails
'''
- image = ExerciseImage.objects.get(pk=pk)
+ try:
+ image = ExerciseImage.objects.get(pk=pk)
+ except ExerciseImage.DoesNotExist:
+ return Response([])
+
thumbnails = {}
for alias in aliases.all():
t = get_thumbnailer(image.image)