From fc6e215cc288ce0488ca7b0340fe2eccbb40df8e Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 28 Oct 2024 16:37:34 +0000 Subject: [PATCH] . --- oef/templates/oef/base.html | 1 + oef/templates/oef/subspecialties.html | 39 +++++++++++++++++++++++++++ oef/urls.py | 3 +++ oef/views.py | 13 +++++++++ 4 files changed, 56 insertions(+) create mode 100644 oef/templates/oef/subspecialties.html diff --git a/oef/templates/oef/base.html b/oef/templates/oef/base.html index eadcebc7..9af33024 100644 --- a/oef/templates/oef/base.html +++ b/oef/templates/oef/base.html @@ -7,5 +7,6 @@ Entries / Formats / Questions / + By subspecialty / Replace Questions / {% endblock %} \ No newline at end of file diff --git a/oef/templates/oef/subspecialties.html b/oef/templates/oef/subspecialties.html new file mode 100644 index 00000000..64f29429 --- /dev/null +++ b/oef/templates/oef/subspecialties.html @@ -0,0 +1,39 @@ +{% extends 'oef/base.html' %} +{% block content %} +

Subspecialties

+ + + + {% for subspecialty, formats in formats %} +

Subspecialty

+ + {% for format in formats %} + {{format}} + + + {% endfor %} + + + {% endfor %} + + + + +{% endblock content %} + + +{% block css %} + + +{% endblock css %} diff --git a/oef/urls.py b/oef/urls.py index 15dddbe1..c5076e13 100644 --- a/oef/urls.py +++ b/oef/urls.py @@ -29,6 +29,9 @@ urlpatterns = [ path( "entries/questions", views.questions, name="questions" ), + path( + "entries/subspecialties", views.subspecialties, name="subspecialties" + ), path( "entries/all", views.entries, name="entries" ), diff --git a/oef/views.py b/oef/views.py index 64f71a1f..fcd0879b 100644 --- a/oef/views.py +++ b/oef/views.py @@ -5,6 +5,8 @@ from django.shortcuts import get_object_or_404, render from django.views.generic.edit import UpdateView, CreateView from django.views.generic.detail import DetailView +from atlas.models import Subspecialty + from .models import Entry, Formats # Create your views here. from .tables import EntryTable @@ -116,6 +118,17 @@ def format_search(request): return render(request, "oef/format_search_results.html", {"entries": entries}) return render(request, "oef/format_search.html",) +def subspecialties(request): + subspecialties = Subspecialty.objects.all() + + format_map = [] + for s in subspecialties: + format_map.append((s, s.formats_set.all())) + + return render(request, "oef/subspecialties.html", context={ + "format_map": format_map + }) + def questions(request): questions = set(Entry.objects.filter(inactive=False).values_list("questions", flat=True))