.
This commit is contained in:
+4
-3
@@ -320,7 +320,7 @@ class ExamViews(View, LoginRequiredMixin):
|
|||||||
for exam in exams:
|
for exam in exams:
|
||||||
if exam.active:
|
if exam.active:
|
||||||
if exam.json_creation_time:
|
if exam.json_creation_time:
|
||||||
creation_time = exam.json_creation_time.timestamp()
|
creation_time = exam.json_creation_time.isoformat()
|
||||||
else:
|
else:
|
||||||
creation_time = "None"
|
creation_time = "None"
|
||||||
active_exams["exams"].append(
|
active_exams["exams"].append(
|
||||||
@@ -378,15 +378,16 @@ class ExamViews(View, LoginRequiredMixin):
|
|||||||
return redirect(url)
|
return redirect(url)
|
||||||
return JsonResponse(exam_json_cache)
|
return JsonResponse(exam_json_cache)
|
||||||
|
|
||||||
|
time = datetime.now()
|
||||||
|
|
||||||
with open(path, "w+") as f:
|
with open(path, "w+") as f:
|
||||||
exam_json = exam.get_exam_json()
|
exam_json = exam.get_exam_json()
|
||||||
exam_json["generated"] = datetime.now().timestamp()
|
exam_json["generated"] = time.isoformat()
|
||||||
f.write(json.dumps(exam_json))
|
f.write(json.dumps(exam_json))
|
||||||
|
|
||||||
exam.recreate_json = False
|
exam.recreate_json = False
|
||||||
|
|
||||||
exam.json_creation_time = datetime.now()
|
exam.json_creation_time = time
|
||||||
exam.save()
|
exam.save()
|
||||||
|
|
||||||
# We also try to clear the cache of any associated questions (longs)
|
# We also try to clear the cache of any associated questions (longs)
|
||||||
|
|||||||
+2
-2
@@ -120,7 +120,7 @@ class Long(models.Model):
|
|||||||
help_text="If the json cache needs updating", default=False
|
help_text="If the json cache needs updating", default=False
|
||||||
)
|
)
|
||||||
|
|
||||||
json_creation_time = models.DateTimeField(blank=True, default=None, null=True)
|
json_creation_time = models.DateTimeField(blank=True, default=None)
|
||||||
|
|
||||||
#question_file = models.FileField(upload_to=question_file_directory_path, blank=True, null=True)
|
#question_file = models.FileField(upload_to=question_file_directory_path, blank=True, null=True)
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ class Long(models.Model):
|
|||||||
"title": "{}",
|
"title": "{}",
|
||||||
"type": "long",
|
"type": "long",
|
||||||
"generated": "{}",
|
"generated": "{}",
|
||||||
""".format(q.history, datetime.datetime.now().timestamp())
|
""".format(q.history, datetime.datetime.now().isoformat())
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user