diff --git a/anatomy/migrations/0005_auto_20201126_1730.py b/anatomy/migrations/0005_auto_20201126_1730.py new file mode 100644 index 00000000..fecda219 --- /dev/null +++ b/anatomy/migrations/0005_auto_20201126_1730.py @@ -0,0 +1,39 @@ +# Generated by Django 3.1.3 on 2020-11-26 17:30 + +import anatomy.models +import django.core.files.storage +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('anatomy', '0004_auto_20201123_1619'), + ] + + operations = [ + migrations.RenameField( + model_name='structure', + old_name='bodypart', + new_name='structure', + ), + migrations.RemoveField( + model_name='exam', + name='recreate_json', + ), + #migrations.AddField( + # model_name='anatomyquestion', + # name='open_access', + # field=models.BooleanField(default=True, help_text='If an question should be freely available to browse'), + #), + migrations.AlterField( + model_name='anatomyquestion', + name='image', + field=models.ImageField(storage=django.core.files.storage.FileSystemStorage(base_url='http://161.35.163.87//media/anatomy/', location='/home/ross/scripts/sites/rad/media//anatomy/'), upload_to=anatomy.models.image_directory_path), + ), + migrations.AlterField( + model_name='exam', + name='exam_questions', + field=models.ManyToManyField(blank='true', related_name='exams', to='anatomy.AnatomyQuestion'), + ), + ] diff --git a/anatomy/models.py b/anatomy/models.py index 65972c44..a9eb1786 100644 --- a/anatomy/models.py +++ b/anatomy/models.py @@ -37,10 +37,10 @@ class BodyPart(models.Model): class Structure(models.Model): - bodypart = models.CharField(max_length=200) + structure = models.CharField(max_length=200) def __str__(self): - return self.bodypart + return self.structure class Modality(models.Model): @@ -193,7 +193,7 @@ class Answer(models.Model): class Exam(models.Model): name = models.CharField(max_length=200) exam_questions = models.ManyToManyField(AnatomyQuestion, - related_name="exams") + related_name="exams", blank="true") active = models.BooleanField(help_text="If an exam should be available", default=True) diff --git a/anatomy/templates/anatomy/exam_overview.html b/anatomy/templates/anatomy/exam_overview.html index 1822fcfc..2afff880 100644 --- a/anatomy/templates/anatomy/exam_overview.html +++ b/anatomy/templates/anatomy/exam_overview.html @@ -1,6 +1,8 @@ {% extends 'anatomy/exams.html' %} {% block content %} + +{% load thumbnail %}

Exam: {{ exam.name }}

This exam has {{question_number}} questions. @@ -9,7 +11,8 @@
    {% for question in questions.all %} -
  1. {{ question }} + +
  2. {{ question }}thumbailthumbail
  3. {% endfor %}
JSON diff --git a/anatomy/templates/anatomy/index.html b/anatomy/templates/anatomy/index.html index c77de4bd..2cefa622 100644 --- a/anatomy/templates/anatomy/index.html +++ b/anatomy/templates/anatomy/index.html @@ -3,7 +3,7 @@ {% block content %} {% for exam in exams %}
-

Exam {{ forloop.counter }}

+

Exam: {{ exam.name }}

{% if request.user.is_staff %}Mark answers{% endif %} {% if request.user.is_staff %}Scores{% endif %}