fix area sorting in editor geometries
This commit is contained in:
parent
aac7fbf23a
commit
d296d25c4b
1 changed files with 6 additions and 4 deletions
|
@ -121,9 +121,11 @@ class EditorViewSet(EditorViewSetMixin, ViewSet):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def area_sorting_func(area):
|
def area_sorting_func(area):
|
||||||
for group in area.groups.all():
|
groups = tuple(area.groups.all())
|
||||||
return (1, group.priority, group.category.priority)
|
print(groups)
|
||||||
|
if not groups:
|
||||||
return (0, 0, 0)
|
return (0, 0, 0)
|
||||||
|
return (1, groups[0].category.priority, groups[0].priority)
|
||||||
|
|
||||||
# noinspection PyPep8Naming
|
# noinspection PyPep8Naming
|
||||||
@action(detail=False, methods=['get'])
|
@action(detail=False, methods=['get'])
|
||||||
|
@ -287,7 +289,7 @@ class EditorViewSet(EditorViewSetMixin, ViewSet):
|
||||||
).prefetch_related(
|
).prefetch_related(
|
||||||
Prefetch('groups', LocationGroup.objects.only(
|
Prefetch('groups', LocationGroup.objects.only(
|
||||||
'color', 'category', 'priority', 'category__priority', 'category__allow_areas'
|
'color', 'category', 'priority', 'category__priority', 'category__allow_areas'
|
||||||
).filter(color__isnull=False))
|
))
|
||||||
)
|
)
|
||||||
for area in areas:
|
for area in areas:
|
||||||
area.opacity = 0.5
|
area.opacity = 0.5
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue