This commit is contained in:
Ross
2021-08-01 09:48:01 +01:00
parent 64737ee341
commit 9b057e3e47
13 changed files with 201 additions and 87 deletions
@@ -0,0 +1,23 @@
# Generated by Django 3.2.4 on 2021-08-01 08:47
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('longs', '0039_auto_20210801_0918'),
]
operations = [
migrations.RenameField(
model_name='exam',
old_name='json_creation_id',
new_name='exam_json_id',
),
migrations.RenameField(
model_name='long',
old_name='json_creation_id',
new_name='question_json_id',
),
]
+4 -4
View File
@@ -126,7 +126,7 @@ class Long(models.Model):
json_creation_time = models.DateTimeField(blank=True, default=None, null=True)
json_creation_id = models.IntegerField(default=1, help_text="Auto incrementing json creation number")
question_json_id = models.IntegerField(default=1, help_text="Auto incrementing json creation number")
#question_file = models.FileField(upload_to=question_file_directory_path, blank=True, null=True)
@@ -214,7 +214,7 @@ class Long(models.Model):
url= "{0}longs/questions/{1}.json".format(settings.MEDIA_URL, question_id)
timestamp = datetime.datetime.now()
q.json_creation_id += 1
q.question_json_id += 1
with open(path, "w+") as f:
@@ -224,7 +224,7 @@ class Long(models.Model):
"type": "long",
"generated": "{}",
"creation_id": "{}",
""".format(q.history, timestamp.isoformat(), q.json_creation_id)
""".format(q.history, timestamp.isoformat(), q.question_json_id)
)
@@ -589,7 +589,7 @@ class Exam(ExamBase):
# If it is a new question we need to for a question json refresh
if q.json_creation_time is None:
q.get_json(q.pk)
exam_questions[q.id] = q.json_creation_id
exam_questions[q.id] = q.question_json_id
else:
# TODO: combine with question_json
+10 -1
View File
@@ -45,11 +45,20 @@
</li>
{% endfor %}
</ol>
<div>
Author: {% for author in exam.author.all %}
{{ author }},
{% endfor %}
</div>
<p><button id='button-edit-order'>Edit exam order</button></p>
<div>
JSON creation time: {{exam.json_creation_time}} ({{exam.json_creation_time|date:"c"}}),
JSON creation id: {{exam.exam_json_id}}
</div>
<a href="{% url 'longs:exam_json' pk=exam.pk %}">JSON</a>
<a href="{% url 'longs:exam_json_recreate' pk=exam.pk %}">Refresh JSON cache</a>
<button id='button-open-access'>Make questions open access</button>
<button id='button-closed-access'>Make questions closed access</button>
<button id='button-edit-order'>Edit exam order</button>
</div>
<script type="text/javascript">
@@ -58,7 +58,7 @@
</div>
<div>
JSON creation time: {{question.json_creation_time}} ({{question.json_creation_time|date:"c"}}),
JSON creation id: {{question.json_creation_id}}
JSON creation id: {{question.question_json_id}}
</div>
<a href="{% url 'longs:question_json' pk=question.pk %}">JSON</a>
<a href="{% url 'longs:question_json_recreate' pk=question.pk %}">Refresh JSON cache</a>
@@ -26,8 +26,4 @@ This series is not associated with any cases.
{% for image in series.images.all %}
{{image.image.url}}, pos: {{image.position}}, {{image.upload_filename}}</br>
{% endfor %}
<div>
JSON creation time: {{question.json_creation_time}} ({{question.json_creation_time|date:"c"}}),
JSON creation id: {{question.json_creation_id}}
</div>
{% endfor %}