Reputation: 687
How to add images to rss feeds, here is my code snippets
class ArticlesRss(Feed):
description_template = 'feeds/city_description.html'
def get_object(self, request, categoryid):
if categoryid == 'all':
return False
else:
catobj = ArticleCategory.objects.get(id = categoryid)
return catobj
# set the category values
def title(self, obj):
if obj:
return obj.name
else:
return _('Latest Article')
def link(self, obj):
if obj:
return obj.get_absolute_url()
else:
return global_settings.website_url
# set the one by one objects
def item_title(self, item):
return item.title
def item_description(self, item):
return item.summary
def items(self, obj):
if obj:
return Article.objects.filter(category = obj,status='P').order_by('-id')[:15]
else:
return Article.objects.filter(status='P').order_by('-id')[:50]
I want to add images(article_photo is the field name) to the article feeds, how to add images to the feed?
Upvotes: 0
Views: 624