From 8aa54979af932e61fa05cefe19e369978bc4e7e6 Mon Sep 17 00:00:00 2001 From: Ross Date: Sun, 1 Aug 2021 10:39:09 +0100 Subject: [PATCH] . --- longs/models.py | 4 ---- longs/views.py | 9 ++++++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/longs/models.py b/longs/models.py index 5bda9536..64071d36 100644 --- a/longs/models.py +++ b/longs/models.py @@ -216,12 +216,9 @@ class Long(models.Model): url= "{0}longs/questions/{1}.json".format(settings.MEDIA_URL, question_id) timestamp = timezone.now() - print("QID0", self.question_json_id) self.question_json_id += 1 - print("QID", self.question_json_id) - with open(path, "w+") as f: # We manually create the json for long questions to reducem memroy usade @@ -258,7 +255,6 @@ class Long(models.Model): f.write('"image_titles" : {} }}'.format(json.dumps(image_titles))) - print("QID2", self.question_json_id) self.json_creation_time = timestamp self.save() diff --git a/longs/views.py b/longs/views.py index 07f0cbf9..82acfe76 100755 --- a/longs/views.py +++ b/longs/views.py @@ -970,11 +970,8 @@ def question_json(request, pk): path= "{0}longs/questions/{1}.json".format(settings.MEDIA_ROOT, pk) url= "{0}longs/questions/{1}.json".format(settings.MEDIA_URL, pk) - print("PRE") if os.path.isfile(path) and not question.recreate_json: - print("GEN") return redirect(url) - print("POST") question_json = question.get_question_json() @@ -991,6 +988,12 @@ def question_json_recreate(request, pk): question.recreate_json = True question.save() + # We also have to invalidate any exams + + for exam in question.exams.all(): + exam.recreate_json = True + exam.save() + #question.get_question_json() return redirect("longs:question_detail", pk=pk) \ No newline at end of file