.
This commit is contained in:
+5
-5
@@ -993,16 +993,16 @@ def question_json(request, pk):
|
||||
#if not exam.active:
|
||||
# raise Http404("No available exam")
|
||||
|
||||
question_json_cache = cache.get("{}_question_json_{}".format("longs", pk))
|
||||
path= "{0}longs/questions/{1}.json".format(settings.MEDIA_ROOT, question_id)
|
||||
url= "{0}{1}/exam/{2}.json".format(settings.MEDIA_URL, self.app_name, pk)
|
||||
|
||||
if os.path.isfile(path) and not exam.recreate_json:
|
||||
|
||||
if question_json_cache is not None and not question.recreate_json:
|
||||
#question_json_cache["cached"] = True
|
||||
return redirect(question_json_cache)
|
||||
return redirect(url)
|
||||
|
||||
question_json = question.get_json(pk)
|
||||
|
||||
cache.set("{}_question_json_{}".format("longs", pk), question_json, 3600)
|
||||
|
||||
question.recreate_json = False
|
||||
question.save()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user