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

Use label_ attribute in annotate_documentations

parent 62fe64b3
No related branches found
No related tags found
1 merge request!120Resolve "Support events and extra lessons in class register"
......@@ -76,12 +76,12 @@ def annotate_documentations(
instances = instances.order_by("period__weekday", "period__period")
else:
instances = instances.order_by("period_from__weekday", "period_from__period")
args = {Event: "event", LessonPeriod: "lesson_period", ExtraLesson: "extra_lesson"}
instances = instances.annotate(
has_documentation=Exists(
LessonDocumentation.objects.filter(
~Q(topic__exact=""), week=wanted_week.week, year=wanted_week.year,
).filter(**{args[klass]: OuterRef("pk")})
).filter(**{klass.label_: OuterRef("pk")})
)
)
......
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