Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
14
Issues
14
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
La Quadrature du Net
rpteam
rp
Commits
75c766ec
Verified
Commit
75c766ec
authored
Sep 11, 2017
by
Thibaut Broggi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add filter by tag for RSS feed
parent
f20c705f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
apps/rp/feeds/feeds.py
apps/rp/feeds/feeds.py
+10
-0
apps/rp/feeds/urls.py
apps/rp/feeds/urls.py
+3
-2
No files found.
apps/rp/feeds/feeds.py
View file @
75c766ec
...
...
@@ -31,3 +31,13 @@ class ArticlesFeed(Feed):
def
item_categories
(
self
,
item
):
return
item
.
tags
.
all
()
class
ArticlesTagsFeed
(
ArticlesFeed
):
def
__init__
(
self
,
**
kwargs
):
pass
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
apps/rp/feeds/urls.py
View file @
75c766ec
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
())
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment