Verified Commit a88675d4 authored by Thibaut Broggi's avatar Thibaut Broggi
Browse files

Add RSS feed for articles in french

parent a2b55e87
Pipeline #1214 passed with stages
in 2 minutes and 2 seconds
from django.contrib.syndication.views import Feed
from django.urls import reverse
from rp.models import Article
class ArticlesFeed(Feed):
title = "Revue de presse de la Quadrature"
link = "/feed/"
description = "La revue de presse recense les articles de presse relatifs aux sujets de la Quadrature. Elle est compilée chaque jour par ses bénévoles, à partir de la presse francophone et internationale. Bonne lecture !"
def items(self):
return Article.objects.filter(lang="FR") \
def item_title(self, item):
return item.title
def item_description(self, item):
return item.extracts
def item_link(self, item):
return item.url
def item_pubdate(self, item):
return item.published_at
def item_updateddate(self, item):
return item.updated_at
def item_categories(self, item):
return item.tags.all()
from django.conf.urls import url
from .feeds import ArticlesFeed
urlpatterns = [
url(r'^articles$', ArticlesFeed(), name='articles-feed'),
......@@ -19,6 +19,7 @@ urlpatterns = [
url(r'^i18n/', include('django.conf.urls.i18n')),
url(r"^api/", include(router.urls, namespace="api")),
url(r"^feeds/", include("rp.feeds.urls", namespace="feeds")),
url(r"^rp/", include("rp.urls", namespace="rp")),
url(r'^accounts/', include('allauth.urls')),
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