- Author:
- agusmakmun
- Posted:
- February 13, 2016
- Language:
- Python
- Version:
- 1.7
- Score:
- 0 (after 0 ratings)
This RSS using Rss201rev2Feed
from Django. And we found it from source code of blog.pythonanywhere.com: https://github.com/pythonanywhere/jab/blob/master/jab/feeds.py
Demo: http://django.id/blog/feed/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Rss201rev2Feed
from django.core.urlresolvers import reverse
from .models import Post
class CorrectMimeTypeFeed(Rss201rev2Feed):
mime_type = 'application/xml'
class LatestPosts(Feed):
feed_type = CorrectMimeTypeFeed
title = "Feed Blog Posts"
link = "/feed/"
description = "Latest Feed Blog Posts"
def author_name(self):
return "Summon Agus"
def items(self):
return Post.objects.published()[:10]
def item_title(self, item):
return item.title
def item_description(self, item):
return item.detail
def item_author_name(self, item):
return item.author.username
def item_link(self, item):
return reverse('detail_blog_post_page', args=[item.slug])
def item_pubdate(self, item):
return item.modified
|
More like this
- Template tag - list punctuation for a list of items by shapiromatron 10 months, 1 week ago
- JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 10 months, 2 weeks ago
- Serializer factory with Django Rest Framework by julio 1 year, 5 months ago
- Image compression before saving the new model / work with JPG, PNG by Schleidens 1 year, 6 months ago
- Help text hyperlinks by sa2812 1 year, 6 months ago
Comments
Please login first before commenting.