Answer the question
In order to leave comments, you need to log in
How to create one rss feed from many models?
I don't know how to solve this problem.
django 1.7
I create a standard rss feed using the standard django.contrib.syndication.views.Feed functionality.
When accessing the /rss address, it is necessary to give a feed from several models.
rss.py code where we create a feed class with 10 latest article entries.
class ArticleFeed(Feed):
feed_type = Rss201rev2Feed
title = "All last article feed"
link = "/articles/"
description = "Все новые статьи."
def items(self):
articles = Article.objects.order_by('-created')[:10]
return articles
def item_title(self, item):
return item.title
def item_description(self, item):
return item.preview
def item_link(self, item):
return reverse('article_show', args=[item.pk, item.slug])
from somewhere.rss import ArticleFeed
...
url(r'^feed/$', ArticleFeed()),
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question