Skip to content

Commit

Permalink
Order by tag name to ensure consistent ordering of tags in API results.
Browse files Browse the repository at this point in the history
  • Loading branch information
rtibbles committed Jun 15, 2021
1 parent 5234a96 commit 8d56499
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions kolibri/core/content/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,13 @@ def get_related_data_maps(self, items, queryset):

tags_map = {}

for t in models.ContentTag.objects.filter(tagged_content__in=queryset).values(
"tag_name",
"tagged_content",
for t in (
models.ContentTag.objects.filter(tagged_content__in=queryset)
.values(
"tag_name",
"tagged_content",
)
.order_by("tag_name")
):
if t["tagged_content"] not in tags_map:
tags_map[t["tagged_content"]] = [t["tag_name"]]
Expand Down

0 comments on commit 8d56499

Please sign in to comment.