diff options
-rw-r--r-- | app/podcasts/templates/podcasts/list-episode.html | 31 | ||||
-rw-r--r-- | app/podcasts/urls.py | 4 | ||||
-rw-r--r-- | app/podcasts/views.py | 18 |
3 files changed, 49 insertions, 4 deletions
diff --git a/app/podcasts/templates/podcasts/list-episode.html b/app/podcasts/templates/podcasts/list-episode.html new file mode 100644 index 0000000..89b7ea8 --- /dev/null +++ b/app/podcasts/templates/podcasts/list-episode.html @@ -0,0 +1,31 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{% load pagination_tags %} +{% load comments %} + +{% block pagetitle %}The Lulu and Birdie Podcast{% endblock %} +{% block metadescription %}The Adventures of Lulu, Birdie, and Henry in podcast form - by Scott Gilbertson.{% endblock %} +{% block breadcrumbs %}{% include "lib/breadcrumbs.html" with breadcrumbs=breadcrumbs %}{% endblock %} +{% block primary %}<main role="main" class="archive-wrapper"> + <div class="archive-intro"> + <h1 class="archive-hed">{{podcast.title}}</h1> + {% if object.subtitle %}<h2 class="list-subhed">{{podcast.subtitle}}</h2>{% endif %} + </div> + + <h1 class="archive-sans">Episodes</h1>{% autopaginate object_list 24 %} + <ul class="archive-list">{% for object in object_list %} + <li class="h-entry hentry archive-list-card archive-list-card-sm" itemscope itemType="http://schema.org/Article"> + <span class="date dt-published card-smcaps">{{object.pub_date|date:"F Y"}}</span> + <a href="{{object.get_absolute_url}}"> + <h2 class="card-hed">{{object.title|safe|smartypants|widont}}</h2> + <p class="p-summary card-lede">{% if object.subtitle %}{{object.subtitle}}{%else%}{{object.meta_description|safe|smartypants|widont}}{%endif%}</p> + </a> + </li> + {%endfor%}</ul> + <a href="{% url 'podcasts_show_feed_atom' podcast.slug 'mp3' %}" >MP3</a> + <a href="{% url 'podcasts_show_feed_atom' podcast.slug 'mp4' %}" >MP4</a> + <a href="{% url 'podcasts_show_feed_rss' podcast.slug 'mp3' %}" >OGG</a> + + + </main> +{%endblock%} diff --git a/app/podcasts/urls.py b/app/podcasts/urls.py index f4e39ea..792388b 100644 --- a/app/podcasts/urls.py +++ b/app/podcasts/urls.py @@ -7,12 +7,12 @@ app_name = "podcasts" urlpatterns = [ re_path( r'<str:slug>/<int:page>', - views.PodcastListView.as_view(), + views.EpisodeListView.as_view(), name="list" ), path( r'<str:slug>/', - views.PodcastListView.as_view(), + views.EpisodeListView.as_view(), {'page':1}, name="list" ), diff --git a/app/podcasts/views.py b/app/podcasts/views.py index 38d761e..9f955b5 100644 --- a/app/podcasts/views.py +++ b/app/podcasts/views.py @@ -24,9 +24,10 @@ class PodcastListView(PaginatedListView): def get_context_data(self, **kwargs): context = super(PodcastListView, self).get_context_data(**kwargs) context['breadcrumbs'] = ['podcast',] - context['podcast'] = Podcast.objects.get(title="The Lulu & Birdie Podcast") + context['podcast'] = Podcast.objects.get(slug=self.kwargs['slug']) return context + class PodcastDetailView(LuxDetailView): """ Return a single episodes @@ -37,6 +38,19 @@ class PodcastDetailView(LuxDetailView): def get_context_data(self, **kwargs): context = super(PodcastListView, self).get_context_data(**kwargs) context['breadcrumbs'] = ['podcast',] - context['podcast'] = Podcast.objects.get(title="The Lulu & Birdie Podcast") + context['podcast'] = Podcast.objects.get(slug=self.kwargs['slug']) return context + +class EpisodeListView(PaginatedListView): + """ + Return a list of Episodes in reverse chronological order + """ + model = Episode + template_name = "podcasts/list-episode.html" + + def get_context_data(self, **kwargs): + context = super(EpisodeListView, self).get_context_data(**kwargs) + context['breadcrumbs'] = ['podcast',] + context['podcast'] = Podcast.objects.get(slug=self.kwargs['slug']) + return context |