mirror of
https://github.com/tjsga/studyguides.git
synced 2025-04-05 03:40:16 -04:00
alphabetize
This commit is contained in:
parent
b626fcae41
commit
d131dccfb5
|
@ -13,7 +13,7 @@ from .models import Subject, Course, Guide, Tag
|
||||||
def subject_view(request, subject_url):
|
def subject_view(request, subject_url):
|
||||||
subject = get_object_or_404(Subject, url=subject_url)
|
subject = get_object_or_404(Subject, url=subject_url)
|
||||||
return render(request, "subject.html", {"subject": subject,
|
return render(request, "subject.html", {"subject": subject,
|
||||||
"courses": subject.courses.all()})
|
"courses": subject.courses.all().order_by("name")})
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def course_view(request, subject_url, course_url):
|
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)
|
course = get_object_or_404(Course, url=course_url)
|
||||||
return render(request, "course.html", {"subject": subject,
|
return render(request, "course.html", {"subject": subject,
|
||||||
"course": course,
|
"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
|
@login_required
|
||||||
def tag_view(request, tag):
|
def tag_view(request, tag):
|
||||||
tag = get_object_or_404(Tag, name=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
|
@login_required
|
||||||
def search_view(request):
|
def search_view(request):
|
||||||
|
|
|
@ -8,4 +8,4 @@ Course = apps.get_model("courses", "Course")
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def index_view(request):
|
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")})
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body id="page">
|
<body id="page">
|
||||||
<span class="bold size-4 my-2 josefin-sans text-center">
|
<span class="bold size-4 my-2 josefin-sans text-center">
|
||||||
TJHSST Study Guide Collection
|
<a href="{% url 'home:index' %}">TJHSST Study Guide Collection</a>
|
||||||
</span>
|
</span>
|
||||||
<main>
|
<main>
|
||||||
{% block disclaimer %}{% endblock %}
|
{% block disclaimer %}{% endblock %}
|
||||||
|
|
|
@ -11,20 +11,13 @@
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="flex-col">
|
<div class="flex-col">
|
||||||
{% for subject, courses in subjects %}
|
{% for subject in subjects %}
|
||||||
<div class="subject">
|
<div class="subject">
|
||||||
<a
|
<a
|
||||||
href="{% url 'courses:subject_view' subject.url %}"
|
href="{% url 'courses:subject_view' subject.url %}"
|
||||||
class="bold size-3">
|
class="bold size-3">
|
||||||
📚 {{ subject.name }}
|
📚 {{ subject.name }}
|
||||||
</a>
|
</a>
|
||||||
<!-- {% for course in courses %}
|
|
||||||
<p class="item">
|
|
||||||
<a href="{% url 'courses:course_view' subject.url course.url %}">
|
|
||||||
{{ course.name }}
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
{% endfor %} -->
|
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user