only query relevant groups
This commit is contained in:
parent
2e0494e767
commit
a554a0ceae
2 changed files with 7 additions and 3 deletions
|
@ -227,7 +227,7 @@ class EditorViewSet(EditorViewSetMixin, ViewSet):
|
|||
).prefetch_related(
|
||||
Prefetch('groups', LocationGroup.objects.only(
|
||||
'color', 'category', 'priority', 'category__priority', 'category__allow_spaces'
|
||||
))
|
||||
).filter(color__isnull=False))
|
||||
)
|
||||
|
||||
space = next(s for s in other_spaces if s.pk == space.pk)
|
||||
|
@ -287,7 +287,7 @@ class EditorViewSet(EditorViewSetMixin, ViewSet):
|
|||
).prefetch_related(
|
||||
Prefetch('groups', LocationGroup.objects.only(
|
||||
'color', 'category', 'priority', 'category__priority', 'category__allow_areas'
|
||||
))
|
||||
).filter(color__isnull=False))
|
||||
)
|
||||
for area in areas:
|
||||
area.opacity = 0.5
|
||||
|
@ -311,7 +311,7 @@ class EditorViewSet(EditorViewSetMixin, ViewSet):
|
|||
space.pois.filter(POI.q_for_request(request)).only('geometry', 'space').prefetch_related(
|
||||
Prefetch('groups', LocationGroup.objects.only(
|
||||
'color', 'category', 'priority', 'category__priority', 'category__allow_pois'
|
||||
))
|
||||
).filter(color__isnull=False))
|
||||
),
|
||||
other_spaces_upper,
|
||||
graphedges,
|
||||
|
|
|
@ -686,6 +686,10 @@ class BaseQueryWrapper(BaseWrapper):
|
|||
# field__lt
|
||||
return self._filter_values(q, field_name, lambda val: val < filter_value)
|
||||
|
||||
if filter_type == 'isnull':
|
||||
# field__isnull
|
||||
return self._filter_values(q, field_name, lambda val: (val is None) is filter_value)
|
||||
|
||||
raise NotImplementedError
|
||||
|
||||
raise NotImplementedError('cannot filter %s by %s (%s)' % (model, filter_name, field))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue