Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
La Quadrature du Net
rpteam
Revue de Press
Commits
e1ec9aef
Commit
e1ec9aef
authored
Jun 17, 2017
by
cynddl
Browse files
Filter by French/international newspapers
parent
cc2b9190
Pipeline
#1156
passed with stages
in 2 minutes and 9 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
apps/rp/templates/rp/article_list_public.html
View file @
e1ec9aef
...
...
@@ -23,8 +23,28 @@
<div
class=
"col-md-10 offset-1"
>
<ul
class=
"nav nav-compressed my-4"
>
{% if view.filter_lang == 'EN' %}
<li
class=
"nav-item"
>
<a
class=
"nav-link active"
href=
"#"
>
<a
class=
"nav-link"
href=
"{% url 'rp:public-article-list' %}"
>
<span
class=
"fa-stack fa-md"
>
<i
class=
"fa fa-circle-thin fa-stack-2x"
></i>
<i
class=
"fa fa-map-marker fa-stack-1x"
></i>
</span>
Presse francophone
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link active"
href=
"{% url 'rp:public-article-list-international' %}"
>
<span
class=
"fa-stack fa-md"
>
<i
class=
"fa fa-circle fa-stack-2x"
></i>
<i
class=
"fa fa-globe fa-stack-1x color-white"
></i>
</span>
Presse internationale
</a>
</li>
{% else %}
<li
class=
"nav-item"
>
<a
class=
"nav-link active"
href=
"{% url 'rp:public-article-list' %}"
>
<span
class=
"fa-stack fa-md"
>
<i
class=
"fa fa-circle fa-stack-2x"
></i>
<i
class=
"fa fa-map-marker fa-stack-1x color-white"
></i>
...
...
@@ -33,7 +53,7 @@
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"
#
"
>
<a
class=
"nav-link"
href=
"
{% url 'rp:public-article-list-international' %}
"
>
<span
class=
"fa-stack fa-md"
>
<i
class=
"fa fa-circle-thin fa-stack-2x"
></i>
<i
class=
"fa fa-globe fa-stack-1x"
></i>
...
...
@@ -41,6 +61,8 @@
Presse internationale
</a>
</li>
{% endif %}
<li
class=
"nav-item ml-auto"
>
<a
class=
"nav-link disabled"
href=
"#"
>
...
...
apps/rp/urls.py
View file @
e1ec9aef
...
...
@@ -6,9 +6,14 @@ from rp.views.articles import ArticleListFlux, ArticleEdit, ArticleDetailView, A
urlpatterns
=
[
url
(
r
"^$"
,
ArticleList
.
as_view
(),
ArticleList
.
as_view
(
filter_lang
=
'FR'
),
name
=
"public-article-list"
),
url
(
r
"^international$"
,
ArticleList
.
as_view
(
filter_lang
=
'EN'
),
name
=
"public-article-list-international"
),
url
(
r
"^article/list/(?P<filter_view>\w+)"
,
login_required
(
ArticleListFlux
.
as_view
()),
...
...
apps/rp/views/articles.py
View file @
e1ec9aef
...
...
@@ -19,11 +19,24 @@ from rp.models import Article
from
.votes
import
UDList
class
ArticleList
(
ListView
):
model
=
Article
paginate_by
=
10
template_name
=
"rp/article_list_public.html"
filter_lang
=
None
def
get_queryset
(
self
):
if
self
.
filter_lang
in
[
"EN"
,
"FR"
]:
qs
=
Article
.
objects
.
filter
(
lang
=
self
.
filter_lang
)
else
:
qs
=
Article
.
objects
.
filter
()
return
qs
.
order_by
(
'-created_at'
)
#
# def get_context_data(self, **kwargs):
# context = super().get_context_data(**kwargs)
# context["filter_lang"] = self.filter_lang
# return context
class
ArticleListFlux
(
UDList
):
...
...
Write
Preview
Supports
Markdown
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