diff --git a/atlas/models.py b/atlas/models.py
index 8eaf6def..1797cd52 100644
--- a/atlas/models.py
+++ b/atlas/models.py
@@ -290,6 +290,17 @@ class Case(models.Model):
return format_html("{}", self.get_absolute_url(), str(self))
def __str__(self):
+ return f"{self.pk}:{self.title}"
+
+ def get_series_blocks(self):
+ html = ""
+ for s in self.series.all():
+ html += s.get_block()
+
+ return html
+
+
+ def get_long_str(self):
examinations = [series.get_examination() for series in self.series.all()]
return f"{self.pk}:{self.title} {'/'.join([str(c) for c in self.condition.all()])} [{', '.join(examinations)}]"
@@ -541,8 +552,17 @@ class CaseCollection(models.Model):
help_text="If a collection should be freely available to browse", default=True
)
+ def get_absolute_url(self):
+ return reverse("atlas:collection_detail_view", kwargs={"pk": self.pk})
+
+ def __str__(self) -> str:
+ return self.name
+
class CaseDetail(models.Model):
case = models.ForeignKey(Case, on_delete=models.CASCADE)
collection = models.ForeignKey(CaseCollection, on_delete=models.CASCADE)
- sort_order = models.IntegerField()
\ No newline at end of file
+ sort_order = models.IntegerField()
+
+ class Meta:
+ ordering = ("sort_order",)
diff --git a/atlas/templates/atlas/collection_case_view.html b/atlas/templates/atlas/collection_case_view.html
new file mode 100644
index 00000000..d2db8823
--- /dev/null
+++ b/atlas/templates/atlas/collection_case_view.html
@@ -0,0 +1,16 @@
+{% extends 'atlas/base.html' %}
+
+{% block content %}
+
Case {{case_number|add:1}}
+
+{{case.get_series_blocks}}
+
+{% if previous %}
+ Previous
+{% endif %}
+{% if next %}
+ Next
+{% endif %}
+
+Return to collection
+{% endblock %}
\ No newline at end of file
diff --git a/atlas/templates/atlas/collection_detail_view.html b/atlas/templates/atlas/collection_detail_view.html
index a501a27c..21d2427c 100644
--- a/atlas/templates/atlas/collection_detail_view.html
+++ b/atlas/templates/atlas/collection_detail_view.html
@@ -1,9 +1,12 @@
{% extends 'atlas/base.html' %}
{% block content %}
+{{collection.name}}
-{% for case in collection %}
-- {{case.title}}: {{case.descriptions}}
+{% for case in collection.cases.all %}
+- Case {{forloop.counter}}
+
+
{% endfor %}
{% endblock %}
\ No newline at end of file
diff --git a/atlas/templates/atlas/collection_index_view.html b/atlas/templates/atlas/collection_index_view.html
index 900924ae..aeb87f34 100644
--- a/atlas/templates/atlas/collection_index_view.html
+++ b/atlas/templates/atlas/collection_index_view.html
@@ -3,7 +3,7 @@
{% block content %}
{% endblock %}
\ No newline at end of file
diff --git a/atlas/urls.py b/atlas/urls.py
index c354b8c1..de169b20 100755
--- a/atlas/urls.py
+++ b/atlas/urls.py
@@ -12,6 +12,7 @@ urlpatterns = [
path("case/", views.CaseView.as_view(), name="case_view"),
path("collection/", views.collection_index_view, name="collection_index_view"),
path("collections/", views.collection_detail_view, name="collection_detail_view"),
+ path("collections//", views.collection_case_view, name="collection_case_view"),
path("condition/", views.ConditionView.as_view(), name="condition_view"),
path("categories/", views.categories_list, name="categories_list"),
path("condition/", views.condition_detail, name="condition_detail"),
diff --git a/atlas/views.py b/atlas/views.py
index d525ecdd..f40b0036 100755
--- a/atlas/views.py
+++ b/atlas/views.py
@@ -897,9 +897,21 @@ def categories_list(request):
def collection_index_view(request):
collections = CaseCollection.objects.all()
- return render(request, "atlas/collection_index.html", {"collections": collections})
+ return render(request, "atlas/collection_index_view.html", {"collections": collections})
def collection_detail_view(request, pk):
- collection = get_object_or_404(CaseCollection, pk)
+ collection = get_object_or_404(CaseCollection, pk=pk)
- return render(request, "atlas/collection_index.html", {"collection": collection})
\ No newline at end of file
+ return render(request, "atlas/collection_detail_view.html", {"collection": collection})
+
+def collection_case_view(request, pk, case_number):
+ collection = get_object_or_404(CaseCollection, pk=pk)
+
+ cases = collection.cases.all()
+ case = cases[case_number]
+
+ previous = case_number > 0
+ next = case_number < (len(cases) - 1)
+
+
+ return render(request, "atlas/collection_case_view.html", {"collection": collection, "case": case, "case_number": case_number, "previous": previous, "next": next})
\ No newline at end of file