diff --git a/anatomy/models.py b/anatomy/models.py
index 3e80b5fd..da94ee3f 100644
--- a/anatomy/models.py
+++ b/anatomy/models.py
@@ -127,6 +127,9 @@ class AnatomyQuestion(QuestionBase):
class Meta:
permissions = ()
+ def get_app_name(self):
+ return "anatomy"
+
def __str__(self):
# Get first answer
return "{}/{}: {} [{}, {}]".format(
@@ -410,6 +413,9 @@ class Exam(ExamBase):
examcollection = models.ForeignKey(ExamCollection, blank=True, null=True, on_delete=models.SET_NULL, related_name="anatomy_exams")
+ def get_app_name(self):
+ return "anatomy"
+
def get_exam_json(self, based=True):
questions = self.get_questions()
diff --git a/anatomy/templates/anatomy/exam_overview.html b/anatomy/templates/anatomy/exam_overview.html
index fe4b4e13..94c322a0 100644
--- a/anatomy/templates/anatomy/exam_overview.html
+++ b/anatomy/templates/anatomy/exam_overview.html
@@ -1,11 +1,14 @@
{% extends 'anatomy/exams.html' %}
+{% block navigation %}
+{{ block.super }}
+ {% include 'generic/exam_overview_headers.html' %}
+{% endblock navigation %}
+
{% block content %}
{% load thumbnail %}
- {% include 'generic/exam_overview_headers.html' %}
-
{% for question in questions %}
diff --git a/anatomy/views.py b/anatomy/views.py
index c7125f00..07bc7a01 100644
--- a/anatomy/views.py
+++ b/anatomy/views.py
@@ -71,7 +71,7 @@ from helpers.images import image_as_base64
from django.template.defaulttags import register
-from generic.mixins import SuperuserRequiredMixin
+from generic.mixins import CheckCanEditMixin, SuperuserRequiredMixin
from rest_framework import viewsets, permissions
@@ -805,10 +805,16 @@ class ExamCreate(ExamCreateBase):
form_class = ExamForm
-class ExamUpdate(ExamUpdateBase, AuthorOrCheckerRequiredMixin):
+class ExamUpdate(CheckCanEditMixin, ExamUpdateBase, AuthorOrCheckerRequiredMixin):
model = Exam
form_class = ExamForm
+ #def get_context_data(self, **kwargs):
+ # context = super().get_context_data(**kwargs)
+
+ # context["can_edit"] = self.object.check_user_can_edit(self.request.user)
+
+ # return context
class ExamDelete(AuthorOrCheckerRequiredMixin, ExamDeleteBase):
model = Exam
@@ -831,10 +837,12 @@ class ExamDelete(AuthorOrCheckerRequiredMixin, ExamDeleteBase):
# return Exam.objects.filter(author__id=user.id)
-class ExamAuthorUpdate(RevisionMixin, LoginRequiredMixin, AuthorRequiredMixin, UpdateView):
+class ExamAuthorUpdate(RevisionMixin, CheckCanEditMixin, LoginRequiredMixin, AuthorRequiredMixin, UpdateView):
model = Exam
form_class = ExamAuthorForm
+ template_name = "author_form.html"
+
GenericViews = GenericViewBase("anatomy", AnatomyQuestion, UserAnswer, Exam)
diff --git a/atlas/models.py b/atlas/models.py
index 6ee96fd0..45205d76 100644
--- a/atlas/models.py
+++ b/atlas/models.py
@@ -5,7 +5,7 @@ import pathlib
from typing import Tuple
from django.http import Http404, HttpRequest
-from generic.mixins import AuthorMixin
+from generic.mixins import AuthorMixin, QuestionMixin
from rad.settings import REMOTE_URL
from django.db.models.fields.files import ImageField
from django.db.models.fields.related import ForeignKey
@@ -273,7 +273,7 @@ class Structure(SynMixin, models.Model):
@reversion.register
-class Case(models.Model, AuthorMixin):
+class Case(models.Model, AuthorMixin, QuestionMixin):
# class SubspecialtyChoices(models.TextChoices):
# BREAST = "BR", _("Breast")
# CARDIAC = "CA", _("Cardiac")
@@ -364,6 +364,9 @@ class Case(models.Model, AuthorMixin):
blank=True,
)
+ def get_app_name(self):
+ return "atlas"
+
# question_file = models.FileField(upload_to=question_file_directory_path, blank=True, null=True)
def get_absolute_url(self):
@@ -373,6 +376,10 @@ class Case(models.Model, AuthorMixin):
# return f"{self.pk}: {self.title}"
return format_html("{}", self.get_absolute_url(), str(self))
+ #def get_base_template(self):
+
+ #def get_edit_template_links(self):
+
def __str__(self):
return f"{self.pk}: {self.title}"
@@ -773,6 +780,12 @@ class CaseCollection(ExamOrCollectionGenericBase):
default=VIEWER_MODE_CHOICES.BUILT_IN,
)
+ def get_app_name(self):
+ return "atlas"
+
+ def get_link_headers(self):
+ return f"{self.get_app_name()}/collection_headers.html"
+
def get_absolute_url(self):
return reverse("atlas:collection_detail", kwargs={"pk": self.pk})
diff --git a/atlas/templates/atlas/case_detail.html b/atlas/templates/atlas/case_detail.html
index 2736a407..c6368a99 100755
--- a/atlas/templates/atlas/case_detail.html
+++ b/atlas/templates/atlas/case_detail.html
@@ -3,33 +3,7 @@
{% block content %}
-
-
+ {% include 'atlas/question_link_header.html' %}
{% include 'atlas/case_display_block.html' %}
diff --git a/atlas/templates/atlas/case_form.html b/atlas/templates/atlas/case_form.html
index 0e43584b..3e3c81c3 100755
--- a/atlas/templates/atlas/case_form.html
+++ b/atlas/templates/atlas/case_form.html
@@ -49,6 +49,10 @@
{% endblock %}
{% block content %}
+ {% if object %}
+ {% include "atlas/question_link_header.html" %}
+ {% endif %}
+
Submit Case
Use this form to create a atlas case. Existing associated image sets can be added using this form.
diff --git a/atlas/templates/atlas/collection_headers.html b/atlas/templates/atlas/collection_headers.html
index 27ded27e..ac776a7b 100644
--- a/atlas/templates/atlas/collection_headers.html
+++ b/atlas/templates/atlas/collection_headers.html
@@ -1,15 +1,14 @@
-
{% if request.user.is_authenticated %}
Collection: {{collection.name}}-> Overview /
Mark /
Scores /
Candidates /
Add New Case /
- Authors