From d131dccfb5ea9cf8806d4dc1bffbe6c4a6e01cdd Mon Sep 17 00:00:00 2001 From: lauren Date: Thu, 12 Nov 2020 19:49:28 -0500 Subject: [PATCH] alphabetize --- studyguides/apps/courses/views.py | 6 +++--- studyguides/apps/home/views.py | 2 +- studyguides/templates/base.html | 2 +- studyguides/templates/home.html | 9 +-------- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/studyguides/apps/courses/views.py b/studyguides/apps/courses/views.py index ddbdf98..adc4919 100644 --- a/studyguides/apps/courses/views.py +++ b/studyguides/apps/courses/views.py @@ -13,7 +13,7 @@ from .models import Subject, Course, Guide, Tag def subject_view(request, subject_url): subject = get_object_or_404(Subject, url=subject_url) return render(request, "subject.html", {"subject": subject, - "courses": subject.courses.all()}) + "courses": subject.courses.all().order_by("name")}) @login_required def course_view(request, subject_url, course_url): @@ -21,12 +21,12 @@ def course_view(request, subject_url, course_url): course = get_object_or_404(Course, url=course_url) return render(request, "course.html", {"subject": subject, "course": course, - "guides": [[g, g.tags.all()] for g in Guide.objects.filter(course=course)]}) + "guides": [[g, g.tags.all()] for g in Guide.objects.filter(course=course).order_by("name")]}) @login_required def tag_view(request, tag): tag = get_object_or_404(Tag, name=tag) - return render(request, "tag.html", {"tag": tag, "guides": [[g, g.tags.all()] for g in tag.guide.all()]}) + return render(request, "tag.html", {"tag": tag, "guides": [[g, g.tags.all()] for g in tag.guide.all().order_by("name")]}) @login_required def search_view(request): diff --git a/studyguides/apps/home/views.py b/studyguides/apps/home/views.py index 9c0b8c6..03d0473 100644 --- a/studyguides/apps/home/views.py +++ b/studyguides/apps/home/views.py @@ -8,4 +8,4 @@ Course = apps.get_model("courses", "Course") @login_required def index_view(request): - return render(request, "home.html", {"subjects": [(subject, Course.objects.filter(subject=subject)) for subject in Subject.objects.all()]}) + return render(request, "home.html", {"subjects": Subject.objects.all().order_by("name")}) diff --git a/studyguides/templates/base.html b/studyguides/templates/base.html index 89751dd..0022135 100644 --- a/studyguides/templates/base.html +++ b/studyguides/templates/base.html @@ -25,7 +25,7 @@ - TJHSST Study Guide Collection + TJHSST Study Guide Collection
{% block disclaimer %}{% endblock %} diff --git a/studyguides/templates/home.html b/studyguides/templates/home.html index d4a9661..feb95db 100644 --- a/studyguides/templates/home.html +++ b/studyguides/templates/home.html @@ -11,20 +11,13 @@ {% block content %}
- {% for subject, courses in subjects %} + {% for subject in subjects %} {% endfor %}