From b7d32e65898e6a9eefced867b9a0f5292d0637f0 Mon Sep 17 00:00:00 2001 From: Ross Date: Thu, 22 Apr 2021 12:43:27 +0100 Subject: [PATCH] . --- anatomy/migrations/0037_auto_20210422_1143.py | 35 +++++++++++++ anatomy/models.py | 5 ++ generic/models.py | 2 + longs/migrations/0033_auto_20210422_1143.py | 28 +++++++++++ physics/migrations/0006_auto_20210422_1143.py | 28 +++++++++++ rapids/migrations/0022_auto_20210422_1143.py | 41 ++++++++++++++++ rapids/models.py | 6 +++ rapids/templates/rapids/exam_overview.html | 5 ++ wally/migrations/0001_initial.py | 49 +++++++++++++++++++ 9 files changed, 199 insertions(+) create mode 100644 anatomy/migrations/0037_auto_20210422_1143.py create mode 100644 longs/migrations/0033_auto_20210422_1143.py create mode 100644 physics/migrations/0006_auto_20210422_1143.py create mode 100644 rapids/migrations/0022_auto_20210422_1143.py create mode 100644 wally/migrations/0001_initial.py diff --git a/anatomy/migrations/0037_auto_20210422_1143.py b/anatomy/migrations/0037_auto_20210422_1143.py new file mode 100644 index 00000000..58d46330 --- /dev/null +++ b/anatomy/migrations/0037_auto_20210422_1143.py @@ -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'), + ), + ] diff --git a/anatomy/models.py b/anatomy/models.py index 098fea5d..eb4b69ef 100644 --- a/anatomy/models.py +++ b/anatomy/models.py @@ -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() diff --git a/generic/models.py b/generic/models.py index 81828e53..a92d45e9 100644 --- a/generic/models.py +++ b/generic/models.py @@ -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 diff --git a/longs/migrations/0033_auto_20210422_1143.py b/longs/migrations/0033_auto_20210422_1143.py new file mode 100644 index 00000000..6fc1cdf2 --- /dev/null +++ b/longs/migrations/0033_auto_20210422_1143.py @@ -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'), + ), + ] diff --git a/physics/migrations/0006_auto_20210422_1143.py b/physics/migrations/0006_auto_20210422_1143.py new file mode 100644 index 00000000..4ea90830 --- /dev/null +++ b/physics/migrations/0006_auto_20210422_1143.py @@ -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'), + ), + ] diff --git a/rapids/migrations/0022_auto_20210422_1143.py b/rapids/migrations/0022_auto_20210422_1143.py new file mode 100644 index 00000000..e55c2788 --- /dev/null +++ b/rapids/migrations/0022_auto_20210422_1143.py @@ -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), + ), + ] diff --git a/rapids/models.py b/rapids/models.py index 7b593fca..e46e97fc 100644 --- a/rapids/models.py +++ b/rapids/models.py @@ -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() diff --git a/rapids/templates/rapids/exam_overview.html b/rapids/templates/rapids/exam_overview.html index f939bd62..84a746cc 100644 --- a/rapids/templates/rapids/exam_overview.html +++ b/rapids/templates/rapids/exam_overview.html @@ -37,6 +37,11 @@ {% endfor %} +
+ Author: {% for user in exam.author.all %} + {{ author }}, + {% endfor %} +
JSON JSON (unbased) Refresh JSON cache diff --git a/wally/migrations/0001_initial.py b/wally/migrations/0001_initial.py new file mode 100644 index 00000000..6ec1b4a8 --- /dev/null +++ b/wally/migrations/0001_initial.py @@ -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')), + ], + ), + ]