.
This commit is contained in:
+6
-2
@@ -120,6 +120,8 @@ class Long(models.Model):
|
||||
help_text="If the json cache needs updating", default=False
|
||||
)
|
||||
|
||||
json_creation_time = models.DateTimeField(blank=True)
|
||||
|
||||
#question_file = models.FileField(upload_to=question_file_directory_path, blank=True, null=True)
|
||||
|
||||
def get_absolute_url(self):
|
||||
@@ -175,11 +177,11 @@ class Long(models.Model):
|
||||
url= "{0}longs/questions/{1}.json".format(settings.MEDIA_URL, question_id)
|
||||
with open(path, "w+") as f:
|
||||
|
||||
# We manually create the json for long questions to reducem memroy usade
|
||||
f.write("""{{
|
||||
"title": "{}",
|
||||
"image_titles": "{}",
|
||||
"type": "long",
|
||||
"generated": "long",
|
||||
"generated": "{}",
|
||||
""".format(q.history, datetime.datetime.now().isoformat())
|
||||
)
|
||||
|
||||
@@ -209,6 +211,8 @@ class Long(models.Model):
|
||||
f.write('"image_titles" : {} }}'.format(json.dumps(image_titles)))
|
||||
|
||||
|
||||
self.json_creation_time = datetime.datetime.now()
|
||||
self.save()
|
||||
|
||||
#exam_question = {
|
||||
# "title": q.history,
|
||||
|
||||
Reference in New Issue
Block a user