location api: only prefetch location groups that are visible to the user
This commit is contained in:
parent
1536fb0e10
commit
4f0dce05a1
1 changed files with 1 additions and 1 deletions
|
@ -238,7 +238,7 @@ class LocationViewSet(RetrieveModelMixin, GenericViewSet):
|
|||
queryset = queryset.filter(reduce(operator.or_, conditions))
|
||||
|
||||
# prefetch locationgroups
|
||||
base_qs = LocationGroup.objects.all().select_related('category')
|
||||
base_qs = LocationGroup.qs_for_request(self.request).select_related('category')
|
||||
for model in get_submodels(SpecificLocation):
|
||||
queryset = queryset.prefetch_related(Prefetch(model._meta.default_related_name + '__groups',
|
||||
queryset=base_qs))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue