diff options
| author | Mark Weiman <mark.weiman@markzz.com> | 2016-01-30 15:09:21 -0500 |
|---|---|---|
| committer | Mark Weiman <mark.weiman@markzz.com> | 2016-01-30 15:09:21 -0500 |
| commit | 7fddc048ba30593e85c057b111562ea878f67fc8 (patch) | |
| tree | 8f4ac336204c3e0cb7b509a1d65289e0e8db0535 | |
| parent | c807679382daa9ba486083f915abc131662e72a0 (diff) | |
| download | website-7fddc048ba30593e85c057b111562ea878f67fc8.tar.gz website-7fddc048ba30593e85c057b111562ea878f67fc8.zip | |
Added timestamp to rss feed
Signed-off-by: Mark Weiman <mark.weiman@markzz.com>
| -rw-r--r-- | blog/feeds.py | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/blog/feeds.py b/blog/feeds.py index e8a3874..a868e0b 100644 --- a/blog/feeds.py +++ b/blog/feeds.py @@ -4,24 +4,28 @@ from django.utils.html import strip_tags as st from .models import Post def truncate_words(content, length=100, suffix='...'): - if len(content) <= length: - return content - else: - return content[:length].rsplit(' ',1)[0] + suffix + if len(content) <= length: + return content + else: + return content[:length].rsplit(' ',1)[0] + suffix class PostFeed(Feed): - title = "Mark Weiman's Blog" - link = "/blog/" - description = "Changes on new post" + title = "Mark Weiman's Blog" + link = "/blog/" + description = "Changes on new post" - def items(self): - return Post.objects.order_by('-created') + def items(self): + return Post.objects.order_by('-created') - def item_title(self, item): - return item.title + def item_title(self, item): + return item.title - def item_description(self, item): - return truncate_words(st(item.body)) + def item_description(self, item): + return truncate_words(st(item.body)) - def item_link(self, item): - return 'https://markzz.com/blog/post/' + str(item.id) + def item_link(self, item): + return 'https://markzz.com/blog/post/' + str(item.id) + + def item_pubdate(self, item): + return item.created + |
