This commit is contained in:
Ross
2024-10-28 16:37:34 +00:00
parent a2907fa285
commit fc6e215cc2
4 changed files with 56 additions and 0 deletions
+1
View File
@@ -7,5 +7,6 @@
<a href="{% url 'oef:entry_table_view' %}">Entries</a> /
<a href="{% url 'oef:formats_view' %}">Formats</a> /
<a href="{% url 'oef:questions' %}">Questions</a> /
<a href="{% url 'oef:subspecialties' %}">By subspecialty</a> /
<a href="{% url 'oef:replace_questions' %}">Replace Questions</a> /
{% endblock %}
+39
View File
@@ -0,0 +1,39 @@
{% extends 'oef/base.html' %}
{% block content %}
<h2>Subspecialties</h2>
{% for subspecialty, formats in formats %}
<h4>Subspecialty</h4>
{% for format in formats %}
{{format}}
{% endfor %}
{% endfor %}
{% endblock content %}
{% block css %}
<style>
li.question {
border: 1px solid white;
}
.format-name {
color: blue;
float: right;
}
.specialties {
color: green;
}
</style>
{% endblock css %}
+3
View File
@@ -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"
),
+13
View File
@@ -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))