From d9b919a588287c44376543d1ae8d16d42fdbeadd Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 8 Mar 2021 11:55:08 +0000 Subject: [PATCH] . --- longs/models.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/longs/models.py b/longs/models.py index 77d40c47..2d6cc589 100644 --- a/longs/models.py +++ b/longs/models.py @@ -170,7 +170,8 @@ class Long(models.Model): q = get_object_or_404(Long, pk=question_id) #exam_order.append(q.id) - path= "{0}longs/questions/{1}".format(settings.MEDIA_ROOT, question_id) + path= "{0}longs/questions/{1}.json".format(settings.MEDIA_ROOT, question_id) + url= "{0}longs/questions/{1}.json".format(settings.MEDIA_URL, question_id) with open(path, "w+") as f: # Loop through longimage associations f.write("[") @@ -185,10 +186,10 @@ class Long(models.Model): # #image_array.append(i.image.url) # We are still limited by the size of a series (although this should not be too big or computers will crash...) - #image_array = [image_as_base64(i.image) for i in series.images.all()] - image_array = [i.image.url for i in series.images.all()] + image_array = [image_as_base64(i.image) for i in series.images.all()] + #image_array = [i.image.url for i in series.images.all()] f.write(json.dumps(image_array)) - #images.append(image_array) + images.append(url) if i != len(question_series) - 1: f.write(",") image_titles.append(series.get_examination())