This commit is contained in:
Ross
2024-10-10 21:58:34 +01:00
parent 2c1043c2dc
commit 57d3ea909a
4 changed files with 46 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
{% extends 'oef/base.html' %}
{% block content %}
<h2>Entries</h2>
Count: {{ entries|length }}
<button
_="on click hide <li.inactive-True/> then show <li.inactive-False/>"
>Hide inactive</button>
<button
_="on click hide <li.inactive-False/> then show <li.inactive-True/>"
>Hide active</button>
<ul>
{% for entry in entries %}
<li class="inactive-{{entry.inactive}}"><a href='{{entry.get_absolute_url}}'>{{entry.exam_code}} / {{entry.exam_name}}</a></li>
{% endfor %}
<li>
{% endblock %}
{% block css %}
<style type="text/css">
.inactive-True a {
color: darkred;
text-decoration: none;
}
.inactive-False a {
text-decoration: none;
}
</style>
{% endblock %}
+2
View File
@@ -5,6 +5,8 @@
{% block content %}
View <a href="{% url 'oef:entries' %}">All</a>
<div id="view-filter-options">
<details><summary>
<h3>Filter Entries</h3>
+3
View File
@@ -26,6 +26,9 @@ urlpatterns = [
path(
"entries/questions", views.questions, name="questions"
),
path(
"entries/all", views.entries, name="entries"
),
path(
"entries/questions_diff", views.questions_diff, name="questions_diff"
),
+5
View File
@@ -91,6 +91,11 @@ def replace_questions(request):
else:
return render(request, "oef/replace_questions.html", {})
def entries(request):
entries = Entry.objects.all()
return render(request, "oef/entries.html", {"entries": entries})
def questions(request):
questions = set(Entry.objects.filter(inactive=False).values_list("questions", flat=True))