Ordered artists on overview
This commit is contained in:
+4
-1
@@ -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)
|
||||
Reference in New Issue
Block a user