From 6316d4bead2ce00ef6c13e031b428f6939f4c35d Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Mon, 27 Feb 2023 11:13:13 -0500 Subject: [PATCH] Fix chart templates --- vrobbler/apps/scrobbles/views.py | 7 ++-- vrobbler/templates/music/artist_detail.html | 4 +-- vrobbler/templates/scrobbles/chart_index.html | 33 +++++++++++++++++-- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/vrobbler/apps/scrobbles/views.py b/vrobbler/apps/scrobbles/views.py index b6d9819..5a890a9 100644 --- a/vrobbler/apps/scrobbles/views.py +++ b/vrobbler/apps/scrobbles/views.py @@ -468,11 +468,11 @@ class ChartRecordView(TemplateView): def get_context_data(self, **kwargs): context_data = super().get_context_data(**kwargs) - date = self.request.GET.get('date') - media_type = self.request.GET.get('media') + date = self.request.GET.get("date") + media_type = self.request.GET.get("media", "Track") user = self.request.user params = {} - context_data['artist_charts'] = {} + context_data["artist_charts"] = {} if not date: context_data['artist_charts'] = { @@ -543,6 +543,7 @@ class ChartRecordView(TemplateView): # TODO recalculate ... + context_data['charts'] = charts context_data['name'] = name context_data['in_progress'] = in_progress return context_data diff --git a/vrobbler/templates/music/artist_detail.html b/vrobbler/templates/music/artist_detail.html index 125b4da..f89fae1 100644 --- a/vrobbler/templates/music/artist_detail.html +++ b/vrobbler/templates/music/artist_detail.html @@ -1,9 +1,9 @@ -{% extends "base_detail.html" %} +{% extends "base_list.html" %} {% load mathfilters %} {% block title %}{{object.name}}{% endblock %} -{% block details %} +{% block lists %}
{% for album in artist.album_set.all %} diff --git a/vrobbler/templates/scrobbles/chart_index.html b/vrobbler/templates/scrobbles/chart_index.html index afafe5d..6e44c78 100644 --- a/vrobbler/templates/scrobbles/chart_index.html +++ b/vrobbler/templates/scrobbles/chart_index.html @@ -4,6 +4,34 @@ {% block lists %}
+ {% if charts %} +
+
+ + + + + + + + + + + {% for chart in charts %} + + + + + + + {% endfor %} + +
RankArtistTrackScrobbles
{{chart.rank}}{{chart.media_obj.artist}}{{chart.media_obj.title}}{{chart.count}}
+
+
+ {% endif %} + + {% if artist_charts %}

Top Artists