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

Move annotate before union because annotating works only before union

parent 6b0eedfd
No related branches found
No related tags found
1 merge request!49Resolve "Add rules and permissions"
Pipeline #2760 passed
......@@ -145,7 +145,13 @@ def week_view(
instance = get_instance_by_pk(request, year, week, type_, id_)
lesson_periods = LessonPeriod.objects.in_week(wanted_week)
lesson_periods = LessonPeriod.objects.in_week(wanted_week).annotate(
has_documentation=Exists(
LessonDocumentation.objects.filter(
~Q(topic__exact=""), lesson_period=OuterRef("pk"), week=wanted_week.week
)
)
)
if type_ and id_:
if isinstance(instance, HttpResponseNotFound):
......@@ -163,14 +169,6 @@ def week_view(
else:
lesson_periods = None
lesson_periods = lesson_periods.annotate(
has_documentation=Exists(
LessonDocumentation.objects.filter(
~Q(topic__exact=""), lesson_period=OuterRef("pk"), week=wanted_week.week
)
)
)
# Add a form to filter the view
if type_:
initial = {type_.value: instance}
......
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