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
e1ec9aef
Commit
e1ec9aef
authored
Jun 17, 2017
by
cynddl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
Showing
3 changed files
with
44 additions
and
4 deletions
+44
-4
apps/rp/templates/rp/article_list_public.html
apps/rp/templates/rp/article_list_public.html
+24
-2
apps/rp/urls.py
apps/rp/urls.py
+6
-1
apps/rp/views/articles.py
apps/rp/views/articles.py
+14
-1
No files found.
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
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