Skip to content

Commit cc97611

Browse files
committed
Fix
1 parent eb9481b commit cc97611

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

landolfio/inventory_frontend/views.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def get_context_data(self, **kwargs):
7676
categories = (
7777
Category.objects.annotate(asset_count=Count("asset"))
7878
.filter(asset_count__gt=0)
79-
.order_by("-asset_count")
79+
.order_by("order", "name")
8080
.prefetch_related("size_set")
8181
)
8282

@@ -129,9 +129,11 @@ def get_context_data(self, **kwargs):
129129
context["locations"] = root_locations
130130

131131
# Get collections with counts
132-
context["collections"] = Collection.objects.annotate(
133-
asset_count=Count("asset")
134-
).order_by("-asset_count")[:5]
132+
context["collections"] = (
133+
Collection.objects.annotate(asset_count=Count("asset"))
134+
.filter(asset_count__gt=0)
135+
.order_by("order", "name")
136+
)
135137

136138
return context
137139

0 commit comments

Comments
 (0)