forked from 00dani/lemoncurry
Whoops, include an updated date on items in Atom/RSS but do it correctly? Also made a few other minor improvements to the feeds
This commit is contained in:
parent
03b2668969
commit
aec98120ab
2 changed files with 11 additions and 4 deletions
|
@ -137,6 +137,10 @@ class Entry(ModelMeta, TimeStampedModel):
|
|||
return '{0} {1}: {2}'.format(self.kind, self.id, self.title)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return self.absolute_url
|
||||
|
||||
@property
|
||||
def absolute_url(self):
|
||||
base = 'https://' + Site.objects.get_current().domain
|
||||
return urljoin(base, self.url)
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ from django.contrib.sites.models import Site
|
|||
from django.contrib.syndication.views import Feed
|
||||
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
|
||||
|
@ -17,6 +16,11 @@ class Atom1FeedWithHub(Atom1Feed):
|
|||
|
||||
|
||||
class EntriesFeed(Feed):
|
||||
item_guid_is_permalink = True
|
||||
|
||||
def item_link(self, entry):
|
||||
return entry.absolute_url
|
||||
|
||||
def item_title(self, entry):
|
||||
return entry.title
|
||||
|
||||
|
@ -30,13 +34,12 @@ class EntriesFeed(Feed):
|
|||
return entry.author.email
|
||||
|
||||
def item_author_link(self, entry):
|
||||
base = 'https://' + Site.objects.get_current().domain
|
||||
return urljoin(base, entry.author.url)
|
||||
return entry.author.absolute_url
|
||||
|
||||
def item_pubdate(self, entry):
|
||||
return entry.published
|
||||
|
||||
def item_updatedate(self, entry):
|
||||
def item_updateddate(self, entry):
|
||||
return entry.updated
|
||||
|
||||
def item_categories(self, entry):
|
||||
|
|
Loading…
Reference in a new issue