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,35 @@
# Generated by Django 3.1.3 on 2021-04-22 11:43
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('anatomy', '0036_exam_exam_mode'),
]
operations = [
migrations.AddField(
model_name='exam',
name='author',
field=models.ManyToManyField(blank=True, help_text='Author of exam', related_name='anatomy_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'),
),
]
+5
View File
@@ -276,6 +276,11 @@ class Exam(ExamBase):
help_text="Exam time limit (in seconds)", default=5400
)
author = models.ManyToManyField(settings.AUTH_USER_MODEL,
blank=True,
help_text='Author of exam',
related_name="anatomy_exam_author")
def get_exam_json(self):
questions = self.exam_questions.all()
+2
View File
@@ -6,6 +6,7 @@ import tagulous
import tagulous.models
from sortedm2m.fields import SortedManyToManyField
from django.conf import settings
class Plane(models.Model):
plane = models.CharField(max_length=200)
@@ -75,6 +76,7 @@ class ExamBase(models.Model):
# default=2100,
#)
class Meta:
abstract = True
@@ -0,0 +1,28 @@
# Generated by Django 3.1.3 on 2021-04-22 11:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('longs', '0032_exam_exam_mode'),
]
operations = [
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'),
),
]
@@ -0,0 +1,28 @@
# Generated by Django 3.1.3 on 2021-04-22 11:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('physics', '0005_exam_exam_mode'),
]
operations = [
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'),
),
]
@@ -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>
+49
View File
@@ -0,0 +1,49 @@
# Generated by Django 3.1.3 on 2021-04-22 11:43
from django.db import migrations, models
import django.db.models.deletion
import wally.models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Question',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('image', models.ImageField(upload_to=wally.models.image_directory_path)),
('hit_box', models.TextField()),
],
),
migrations.CreateModel(
name='Specialty',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('specialty', models.CharField(max_length=200)),
],
),
migrations.CreateModel(
name='Response',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('time_to_find', models.FloatField()),
('hit_point_x', models.FloatField()),
('hit_point_y', models.FloatField()),
('question', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='wally.question')),
],
),
migrations.CreateModel(
name='Candidate',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('age', models.PositiveIntegerField()),
('specialty', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='wally.specialty')),
],
),
]