Skip to content
Snippets Groups Projects
Verified Commit cd55e32d authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Show buttons to get to next or previous lesson on lesson view

parent 43e6be1f
No related branches found
No related tags found
1 merge request!56Resolve "[Lesson view] Show buttons to go the previous/next lesson"
Pipeline #2787 passed
......@@ -28,6 +28,26 @@
{% endblock %}
{% block content %}
<div class="row">
<div class="col s12">
{% with prev_lesson=lesson_period.prev %}
<a class="btn-flat left waves-effect waves-light"
href="{% url "lesson_by_week_and_period" prev_lesson.week.year prev_lesson.week.week prev_lesson.id %}">
<i class="material-icons left">arrow_back</i>
{% trans "Previous lesson" %}
</a>
{% endwith %}
{% with next_lesson=lesson_period.next %}
<a class="btn-flat right waves-effect waves-light"
href="{% url "lesson_by_week_and_period" next_lesson.week.year next_lesson.week.week next_lesson.id %}">
<i class="material-icons right">arrow_forward</i>
{% trans "Next lesson" %}
</a>
{% endwith %}
</div>
</div>
<form method="post">
<div class="row">
<div class="col s12">
......
......@@ -38,8 +38,8 @@ def lesson(
if year and week and period_id:
# Get a specific lesson period if provided in URL
lesson_period = LessonPeriod.objects.get(pk=period_id)
wanted_week = CalendarWeek(year=year, week=week)
lesson_period = LessonPeriod.objects.annotate_week(wanted_week).get(pk=period_id)
else:
# Determine current lesson by current date and time
lesson_period = (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment