This commit is contained in:
Ross
2021-04-22 12:43:27 +01:00
parent 1b738d0edb
commit b7d32e6589
9 changed files with 199 additions and 0 deletions
@@ -0,0 +1,41 @@
# Generated by Django 3.1.3 on 2021-04-22 11:43
from django.conf import settings
from django.db import migrations, models
import rapids.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('rapids', '0021_exam_exam_mode'),
]
operations = [
migrations.AddField(
model_name='exam',
name='author',
field=models.ManyToManyField(blank=True, help_text='Author of exam', related_name='rapid_exam_author', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='exam',
name='active',
field=models.BooleanField(default=False, help_text='If an exam should be available'),
),
migrations.AlterField(
model_name='exam',
name='exam_mode',
field=models.BooleanField(default=True, help_text='If an exam should be taken in exam mode'),
),
migrations.AlterField(
model_name='exam',
name='publish_results',
field=models.BooleanField(default=False, help_text='If an exams results should be available'),
),
migrations.AlterField(
model_name='rapidimage',
name='image',
field=models.FileField(upload_to=rapids.models.image_directory_path),
),
]
+6
View File
@@ -361,6 +361,12 @@ class Exam(ExamBase):
help_text="Exam time limit (in seconds). Default is 2100 secondse (35 minutes)", default=2100
)
author = models.ManyToManyField(settings.AUTH_USER_MODEL,
blank=True,
help_text='Author of exam',
related_name="rapid_exam_author")
def get_normal_abnormal_breakdown(self):
# Inefficient but more extendible
questions = self.exam_questions.all()
@@ -37,6 +37,11 @@
</li>
{% endfor %}
</ol>
<div>
Author: {% for user in exam.author.all %}
{{ author }},
{% endfor %}
</div>
<a href="{% url 'rapids:exam_json' pk=exam.pk %}">JSON</a>
<a href="{% url 'rapids:exam_json_unbased' pk=exam.pk %}">JSON (unbased)</a>
<a href="{% url 'rapids:exam_json_recreate' pk=exam.pk %}">Refresh JSON cache</a>