Overview page
Met klassiek onbruikbare interface dit jaar.
This commit is contained in:
+18
-4
@@ -75,9 +75,6 @@ class NominateView(LoginRequiredMixin, View):
|
||||
json = spt.get_song_info(spotify_id)
|
||||
except:
|
||||
return TemplateResponse(request, "Nominate.html", {"error": "Fout bij het ophalen van het liedje."})
|
||||
print(json)
|
||||
print("hey")
|
||||
|
||||
|
||||
# Album artists
|
||||
album_artists = []
|
||||
@@ -153,4 +150,21 @@ class UndoView(LoginRequiredMixin, View):
|
||||
except Vote.DoesNotExist:
|
||||
raise Exception(f"{request.user} did not vote for {track}")
|
||||
vote.delete()
|
||||
return HttpResponseRedirect('/vote/')
|
||||
return HttpResponseRedirect('/vote/')
|
||||
|
||||
class OverView(LoginRequiredMixin, View):
|
||||
def get(self, request):
|
||||
votes = Vote.objects.select_related().distinct()
|
||||
artists = {}
|
||||
for vote in votes:
|
||||
for artist in vote.track.artists.all():
|
||||
if not artists.get(artist.name):
|
||||
artists[artist.name] = {}
|
||||
for artist in vote.track.album.artists.all():
|
||||
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]
|
||||
context = {
|
||||
"artists": artists
|
||||
}
|
||||
return TemplateResponse(request, "Overview.html", context)
|
||||
Reference in New Issue
Block a user