filter ObstacleGroup in legend endpoint by in_legend

This commit is contained in:
Laura Klünder 2024-09-06 15:09:32 +02:00
parent d49b6d6645
commit 30b467005c

View file

@ -354,6 +354,7 @@ def legend_for_theme(request, theme_id: int):
Prefetch('spaces', Space.qs_for_request(request))
)
obstaclegroups = ObstacleGroup.objects.filter(
in_legend=True,
pk__in=set(Obstacle.qs_for_request(request).filter(group__isnull=False).values_list('group', flat=True)),
)
return LegendSchema(