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
776cf64d
Commit
776cf64d
authored
May 23, 2019
by
Okhin
Browse files
Fixing the redirect loop
parent
1b84d06e
Pipeline
#2617
passed with stages
in 3 minutes and 6 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
apps/rp/tests/test_article.py
View file @
776cf64d
...
...
@@ -122,7 +122,9 @@ class TestArticleViews(TestCase):
def
test_search_view
(
self
):
article
=
ArticleFactory
(
title
=
u
'Zog Zog chez les schtroumphs'
,
lang
=
'FR'
)
lang
=
'FR'
,
archive
=
False
,
status
=
'PUBLISHED'
)
article
.
save
()
r
=
self
.
client
.
get
(
'/rp/'
,
{
'q'
:
'Zog Zog'
})
...
...
@@ -131,7 +133,9 @@ class TestArticleViews(TestCase):
assert
len
(
r
.
context
[
'article_list'
])
==
0
def
test_search_view_archived
(
self
):
archive
=
ArticleFactory
(
archive
=
True
,
lang
=
'FR'
)
archive
=
ArticleFactory
(
archive
=
True
,
lang
=
'FR'
,
status
=
'PUBLISHED'
)
r
=
self
.
client
.
get
(
'/rp/'
,
{
'q'
:
''
,
'archive'
:
'true'
})
assert
len
(
r
.
context
[
'article_list'
])
==
1
...
...
@@ -141,7 +145,10 @@ class TestArticleViews(TestCase):
assert
len
(
r
.
context
[
'article_list'
])
==
0
def
test_search_view_speaks
(
self
):
speak
=
ArticleFactory
(
speak
=
True
,
lang
=
'FR'
)
speak
=
ArticleFactory
(
speak
=
True
,
archive
=
False
,
lang
=
'FR'
,
status
=
'PUBLISHED'
)
r
=
self
.
client
.
get
(
'/rp/'
,
{
'q'
:
''
,
'speak'
:
'true'
})
assert
len
(
r
.
context
[
'article_list'
])
==
1
...
...
@@ -151,7 +158,10 @@ class TestArticleViews(TestCase):
assert
len
(
r
.
context
[
'article_list'
])
==
0
def
test_search_view_quoted
(
self
):
quote
=
ArticleFactory
(
quote
=
True
,
lang
=
'FR'
)
quote
=
ArticleFactory
(
quote
=
True
,
archive
=
False
,
lang
=
'FR'
,
status
=
'PUBLISHED'
)
r
=
self
.
client
.
get
(
'/rp/'
,
{
'q'
:
''
,
'quote'
:
'true'
})
assert
len
(
r
.
context
[
'article_list'
])
==
1
...
...
apps/rp/views/articles.py
View file @
776cf64d
...
...
@@ -138,9 +138,10 @@ class ArticleDetailView(LoginRequiredMixin, DetailView):
return
context
class
ArticleEdit
(
PermissionRequiredMixin
,
UpdateView
):
class
ArticleEdit
(
LoginRequiredMixin
,
PermissionRequiredMixin
,
UpdateView
):
model
=
Article
permission_required
=
'rp.can_edit'
raise_exception
=
True
fields
=
[
'screenshot'
,
'url'
,
'lang'
,
'title'
,
'tags'
,
'extracts'
,
'quote'
,
'speak'
,
'archive'
]
...
...
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