fix: Explicitly order GroupTypeNames in active_group_types

Relying on Meta.ordering to order querysets involving GROUP BY queries
is deprecated and will be dropped in Django 3.1.
This commit is contained in:
Jennifer Richards 2023-05-10 19:19:39 -03:00
parent 406ba7bf0b
commit eee145ee67
No known key found for this signature in database
GPG key ID: 9B2BF5C5ADDA6A6E

View file

@ -317,6 +317,7 @@ def active_group_types(request):
]
)
.filter(group__state="active")
.order_by('order', 'name') # default ordering ignored for "GROUP BY" queries, make it explicit
.annotate(group_count=Count("group"))
)
return render(request, "group/active_groups.html", {"grouptypes": grouptypes})