From 1b6cb4f63a71b6d9d019dad94c5efb4794f98da3 Mon Sep 17 00:00:00 2001 From: Ross Date: Fri, 8 Apr 2022 23:57:24 +0100 Subject: [PATCH] . --- atlas/migrations/0038_auto_20220408_2355.py | 43 +++++++++++++ atlas/migrations/0039_auto_20220408_2357.py | 63 +++++++++++++++++++ atlas/models.py | 41 ++++++++---- .../atlas/collection_case_view_take.html | 10 +-- requirements.txt | 3 +- 5 files changed, 142 insertions(+), 18 deletions(-) create mode 100644 atlas/migrations/0038_auto_20220408_2355.py create mode 100644 atlas/migrations/0039_auto_20220408_2357.py diff --git a/atlas/migrations/0038_auto_20220408_2355.py b/atlas/migrations/0038_auto_20220408_2355.py new file mode 100644 index 00000000..4ce699e5 --- /dev/null +++ b/atlas/migrations/0038_auto_20220408_2355.py @@ -0,0 +1,43 @@ +# Generated by Django 3.2.4 on 2022-04-08 22:55 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('atlas', '0037_cidreportanswer_feedback'), + ] + + operations = [ + migrations.RenameField( + model_name='casecollection', + old_name='show_description', + new_name='show_description_pre', + ), + migrations.RenameField( + model_name='casecollection', + old_name='show_discussion', + new_name='show_discussion_pre', + ), + migrations.RenameField( + model_name='casecollection', + old_name='show_history', + new_name='show_history_pre', + ), + migrations.RenameField( + model_name='casecollection', + old_name='show_report', + new_name='show_report_pre', + ), + migrations.RenameField( + model_name='casecollection', + old_name='show_title', + new_name='show_title_pre', + ), + migrations.AlterField( + model_name='casecollection', + name='publish_results', + field=models.BooleanField(default=False, help_text='If a collection should published'), + ), + ] diff --git a/atlas/migrations/0039_auto_20220408_2357.py b/atlas/migrations/0039_auto_20220408_2357.py new file mode 100644 index 00000000..2940c1ee --- /dev/null +++ b/atlas/migrations/0039_auto_20220408_2357.py @@ -0,0 +1,63 @@ +# Generated by Django 3.2.4 on 2022-04-08 22:57 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('atlas', '0038_auto_20220408_2355'), + ] + + operations = [ + migrations.AddField( + model_name='casecollection', + name='show_description_post', + field=models.BooleanField(default=False, help_text='Show the description of the cases (post exam)'), + ), + migrations.AddField( + model_name='casecollection', + name='show_discussion_post', + field=models.BooleanField(default=False, help_text='Show the case discussion (post exam)'), + ), + migrations.AddField( + model_name='casecollection', + name='show_history_post', + field=models.BooleanField(default=False, help_text='Show the history of the cases (post exam)'), + ), + migrations.AddField( + model_name='casecollection', + name='show_report_post', + field=models.BooleanField(default=False, help_text='Show the case report (post exam)'), + ), + migrations.AddField( + model_name='casecollection', + name='show_title_post', + field=models.BooleanField(default=False, help_text='Show the title of the cases (post exam)'), + ), + migrations.AlterField( + model_name='casecollection', + name='show_description_pre', + field=models.BooleanField(default=False, help_text='Show the description of the cases (pre exam)'), + ), + migrations.AlterField( + model_name='casecollection', + name='show_discussion_pre', + field=models.BooleanField(default=False, help_text='Show the case discussion (pre exam)'), + ), + migrations.AlterField( + model_name='casecollection', + name='show_history_pre', + field=models.BooleanField(default=False, help_text='Show the history of the cases (pre exam)'), + ), + migrations.AlterField( + model_name='casecollection', + name='show_report_pre', + field=models.BooleanField(default=False, help_text='Show the case report (pre exam)'), + ), + migrations.AlterField( + model_name='casecollection', + name='show_title_pre', + field=models.BooleanField(default=False, help_text='Show the title of the cases (pre exam)'), + ), + ] diff --git a/atlas/models.py b/atlas/models.py index 40d4b766..8b9c8f6a 100644 --- a/atlas/models.py +++ b/atlas/models.py @@ -11,7 +11,6 @@ import tagulous import tagulous.models - import pydicom import dicognito.anonymizer @@ -591,7 +590,6 @@ class Series(models.Model): pass - class CaseCollection(models.Model): name = models.CharField(max_length=255, unique=True) @@ -605,19 +603,37 @@ class CaseCollection(models.Model): help_text="If a collection should be available", default=True ) - show_title = models.BooleanField( - default=False, help_text="Show the title of the cases" + show_title_pre = models.BooleanField( + default=False, help_text="Show the title of the cases (pre exam)" ) - show_history = models.BooleanField( - default=False, help_text="Show the history of the cases" + show_history_pre = models.BooleanField( + default=False, help_text="Show the history of the cases (pre exam)" ) - show_description = models.BooleanField( - default=False, help_text="Show the description of the cases" + show_description_pre = models.BooleanField( + default=False, help_text="Show the description of the cases (pre exam)" ) - show_discussion = models.BooleanField( - default=False, help_text="Show the case discussion" + show_discussion_pre = models.BooleanField( + default=False, help_text="Show the case discussion (pre exam)" + ) + show_report_pre = models.BooleanField( + default=False, help_text="Show the case report (pre exam)" + ) + + show_title_post = models.BooleanField( + default=False, help_text="Show the title of the cases (post exam)" + ) + show_history_post = models.BooleanField( + default=False, help_text="Show the history of the cases (post exam)" + ) + show_description_post = models.BooleanField( + default=False, help_text="Show the description of the cases (post exam)" + ) + show_discussion_post = models.BooleanField( + default=False, help_text="Show the case discussion (post exam)" + ) + show_report_post = models.BooleanField( + default=False, help_text="Show the case report (post exam)" ) - show_report = models.BooleanField(default=False, help_text="Show the case report") author = models.ManyToManyField( settings.AUTH_USER_MODEL, @@ -709,6 +725,7 @@ class CaseCollection(models.Model): content_type=content_type, object_id=self.pk, cid_user=cid_user ) + class CaseDetail(models.Model): case = models.ForeignKey(Case, on_delete=models.CASCADE) collection = models.ForeignKey(CaseCollection, on_delete=models.CASCADE) @@ -720,7 +737,7 @@ class CaseDetail(models.Model): class CidReportAnswer(models.Model): - question = models.ForeignKey(CaseDetail, on_delete=models.CASCADE ) + question = models.ForeignKey(CaseDetail, on_delete=models.CASCADE) answer = models.TextField(blank=True) diff --git a/atlas/templates/atlas/collection_case_view_take.html b/atlas/templates/atlas/collection_case_view_take.html index bf054d2a..afaae560 100644 --- a/atlas/templates/atlas/collection_case_view_take.html +++ b/atlas/templates/atlas/collection_case_view_take.html @@ -3,18 +3,18 @@ {% block content %}

Case {{case_number|add:1}} - {% if collection.show_title %} + {% if collection.show_title_pre %} : {{case.title}} {% endif %}

- {% if collection.show_description and case.description%} + {% if collection.show_description_pre and case.description%}
Description: {{case.description}}
{% endif %} - {% if collection.show_history and case.history%} + {% if collection.show_history_pre and case.history%}
History: {{case.history}}
@@ -38,7 +38,7 @@ - {% if collection.show_discussion and case.discussion%} + {% if collection.show_discussion_pre and case.discussion%}
Discussion: @@ -48,7 +48,7 @@
{% endif %} - {% if collection.show_report and case.report%} + {% if collection.show_report_pre and case.report%}
Report: diff --git a/requirements.txt b/requirements.txt index 86d0fcd6..e84314d9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,4 +23,5 @@ django-zipview pymemcache django-autocomplete-light django-querysetsequence -dicognito \ No newline at end of file +dicognito +django_unused_media \ No newline at end of file