Skip to content
Snippets Groups Projects
Verified Commit e0c8fea0 authored by mirabilos's avatar mirabilos Committed by mirabilos
Browse files

Check for missing lesson_period even earlier.

parent ec861d0d
No related branches found
No related tags found
No related merge requests found
......@@ -29,14 +29,14 @@ def lesson(request: HttpRequest, week: Optional[int] = None, period_id: Optional
Q(substitutions__teachers=request.user.person) | Q(lesson__teachers=request.user.person)).first()
wanted_week = current_week()
context['lesson_period'] = lesson_period
context['week'] = wanted_week
context['day'] = week_days(wanted_week)[lesson_period.period.weekday]
if not lesson_period:
#XXX TODO: nice error page (“no lesson currently running for you?” or so)
return HttpResponseNotFound("no current lesson found for you")
context['lesson_period'] = lesson_period
context['week'] = wanted_week
context['day'] = week_days(wanted_week)[lesson_period.period.weekday]
# Create or get lesson documentation object; can be empty when first opening lesson
lesson_documentation, created = LessonDocumentation.objects.get_or_create(
lesson_period=lesson_period, week=wanted_week)
......
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