Skip to content
Snippets Groups Projects

Resolve "Filter selects on week overview and register absence"

1 file
+ 7
9
Compare changes
  • Side-by-side
  • Inline
@@ -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}
Loading