Verified Commit 75c766ec authored by Thibaut Broggi's avatar Thibaut Broggi
Browse files

Add filter by tag for RSS feed

parent f20c705f
......@@ -31,3 +31,13 @@ class ArticlesFeed(Feed):
def item_categories(self, item):
return item.tags.all()
class ArticlesTagsFeed(ArticlesFeed):
def __init__(self, **kwargs):
def items(self):
return Article.objects.filter(tags__name__in=[self.filter_tag])[:25]
def get_object(self, request, filter_tag):
self.filter_tag = filter_tag
from django.conf.urls import url
from .feeds import ArticlesFeed
from .feeds import ArticlesFeed, ArticlesTagsFeed
urlpatterns = [
url(r'^$', ArticlesFeed(filter_lang='FR'), name='articles-feed'),
url(r'^international$', ArticlesFeed(filter_lang='EN'), name='articles-feed-international')
url(r'^international$', ArticlesFeed(filter_lang='EN'), name='articles-feed-international'),
url(r'^by-tag/(?P<filter_tag>.*)', ArticlesTagsFeed())
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment