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

This commit is contained in:
Danielle McLean 2017-11-13 13:16:46 +11:00
parent cedae16456
commit b446c7072c
Signed by untrusted user: 00dani
GPG key ID: 5A5D2D1AFF12EEC5
2 changed files with 7 additions and 6 deletions

View file

@ -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

View file

@ -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