Ordered artists on overview

This commit is contained in:
2024-02-26 21:31:04 +01:00
parent 44e32c59ff
commit 2861c856af
+4 -1
View File
@@ -4,6 +4,7 @@ from django.http import HttpResponse, HttpResponseRedirect
from django.template.response import TemplateResponse
from django.contrib.auth.mixins import LoginRequiredMixin
import re
from collections import OrderedDict
from .models import Track, Artist, Album, Vote, Background, Profile
from .utils import from_json, get_unvoted
from . import spotify
@@ -170,7 +171,9 @@ class OverView(LoginRequiredMixin, View):
if not artists[artist.name].get(vote.track.album.name):
artists[artist.name][vote.track.album.name] = []
artists[artist.name][vote.track.album.name] += [vote.track]
artists_ordered = OrderedDict(sorted(artists.items()))
context = {
"artists": artists
"artists": artists_ordered
}
return TemplateResponse(request, "Overview.html", context)