forked from 00dani/lemoncurry
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:
parent
cedae16456
commit
b446c7072c
2 changed files with 7 additions and 6 deletions
|
@ -4,6 +4,7 @@ from django.urls import reverse
|
||||||
from django.utils.feedgenerator import Atom1Feed
|
from django.utils.feedgenerator import Atom1Feed
|
||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
from lemoncurry.templatetags.markdown import markdown
|
from lemoncurry.templatetags.markdown import markdown
|
||||||
|
from .kinds import on_home
|
||||||
from .models import Entry
|
from .models import Entry
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@ class AtomByKind(RssByKind):
|
||||||
subtitle = RssByKind.description
|
subtitle = RssByKind.description
|
||||||
|
|
||||||
|
|
||||||
class RssAllEntries(EntriesFeed):
|
class RssHomeEntries(EntriesFeed):
|
||||||
def title(self):
|
def title(self):
|
||||||
return Site.objects.get_current().name
|
return Site.objects.get_current().name
|
||||||
|
|
||||||
|
@ -72,9 +73,9 @@ class RssAllEntries(EntriesFeed):
|
||||||
)
|
)
|
||||||
|
|
||||||
def items(self):
|
def items(self):
|
||||||
return Entry.objects.all()
|
return Entry.objects.filter(kind__in=on_home)
|
||||||
|
|
||||||
|
|
||||||
class AtomAllEntries(RssAllEntries):
|
class AtomHomeEntries(RssHomeEntries):
|
||||||
feed_type = Atom1Feed
|
feed_type = Atom1Feed
|
||||||
subtitle = RssAllEntries.description
|
subtitle = RssHomeEntries.description
|
||||||
|
|
|
@ -13,8 +13,8 @@ def prefix(route):
|
||||||
|
|
||||||
app_name = 'entries'
|
app_name = 'entries'
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url('^atom$', feeds.AtomAllEntries(), name='atom'),
|
url('^atom$', feeds.AtomHomeEntries(), name='atom'),
|
||||||
url('^rss$', feeds.RssAllEntries(), name='rss'),
|
url('^rss$', feeds.RssHomeEntries(), name='rss'),
|
||||||
]
|
]
|
||||||
for k in kinds.all:
|
for k in kinds.all:
|
||||||
kind = k.plural
|
kind = k.plural
|
||||||
|
|
Loading…
Reference in a new issue