diff --git a/vrobbler/apps/podcasts/views.py b/vrobbler/apps/podcasts/views.py index 26bedc6..eb954ab 100644 --- a/vrobbler/apps/podcasts/views.py +++ b/vrobbler/apps/podcasts/views.py @@ -1,15 +1,15 @@ import datetime from django.utils import timezone from django.views import generic -from podcasts.models import Podcast +from podcasts.models import Podcast, PodcastEpisode from scrobbles.models import Scrobble from scrobbles.views import ScrobbleableListView, ScrobbleableDetailView -class PodcastListView(generic.ListView): - model = Podcast - paginate_by = 20 +class PodcastListView(ScrobbleableListView): + model = PodcastEpisode + template_name = "podcasts/podcast_list.html" def get_context_data(self, **kwargs): context_data = super().get_context_data(**kwargs) @@ -36,10 +36,7 @@ class PodcastListView(generic.ListView): if podcast: podcasts_this_week[podcast.id] = { "podcast": podcast, - "count": podcasts_this_week.get(podcast.id, {}).get( - "count", 0 - ) - + 1, + "count": podcasts_this_week.get(podcast.id, {}).get("count", 0) + 1, } podcasts_this_month = {} @@ -48,9 +45,7 @@ class PodcastListView(generic.ListView): if podcast: podcasts_this_month[podcast.id] = { "podcast": podcast, - "count": podcasts_this_month.get(podcast.id, {}).get( - "count", 0 - ) + "count": podcasts_this_month.get(podcast.id, {}).get("count", 0) + 1, } diff --git a/vrobbler/templates/_scrobblable_list.html b/vrobbler/templates/_scrobblable_list.html index f9c529c..8dde497 100644 --- a/vrobbler/templates/_scrobblable_list.html +++ b/vrobbler/templates/_scrobblable_list.html @@ -6,6 +6,9 @@
| Episode | -Podcast | -Scrobbles | -
|---|---|---|
| {{episode}} | -{{obj}} | -{{episode.scrobble_set.count}} | -