From b446c7072caa3f40ba18c41612e1bc581fd69060 Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Mon, 13 Nov 2017 13:16:46 +1100 Subject: [PATCH] Also omit entry kinds that don't show on the homepage from the Atom and RSS feeds, since they're supposed to be alternate versions of the homepage content --- entries/feeds.py | 9 +++++---- entries/urls.py | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/entries/feeds.py b/entries/feeds.py index d7ef88c..b8a0b41 100644 --- a/entries/feeds.py +++ b/entries/feeds.py @@ -4,6 +4,7 @@ from django.urls import reverse from django.utils.feedgenerator import Atom1Feed from urllib.parse import urljoin from lemoncurry.templatetags.markdown import markdown +from .kinds import on_home from .models import Entry @@ -59,7 +60,7 @@ class AtomByKind(RssByKind): subtitle = RssByKind.description -class RssAllEntries(EntriesFeed): +class RssHomeEntries(EntriesFeed): def title(self): return Site.objects.get_current().name @@ -72,9 +73,9 @@ class RssAllEntries(EntriesFeed): ) def items(self): - return Entry.objects.all() + return Entry.objects.filter(kind__in=on_home) -class AtomAllEntries(RssAllEntries): +class AtomHomeEntries(RssHomeEntries): feed_type = Atom1Feed - subtitle = RssAllEntries.description + subtitle = RssHomeEntries.description diff --git a/entries/urls.py b/entries/urls.py index d9bb97c..2fff993 100644 --- a/entries/urls.py +++ b/entries/urls.py @@ -13,8 +13,8 @@ def prefix(route): app_name = 'entries' urlpatterns = [ - url('^atom$', feeds.AtomAllEntries(), name='atom'), - url('^rss$', feeds.RssAllEntries(), name='rss'), + url('^atom$', feeds.AtomHomeEntries(), name='atom'), + url('^rss$', feeds.RssHomeEntries(), name='rss'), ] for k in kinds.all: kind = k.plural