Commit 776cf64d authored by Okhin's avatar Okhin
Browse files

Fixing the redirect loop

parent 1b84d06e
Pipeline #2617 passed with stages
in 3 minutes and 6 seconds
...@@ -122,7 +122,9 @@ class TestArticleViews(TestCase): ...@@ -122,7 +122,9 @@ class TestArticleViews(TestCase):
def test_search_view(self): def test_search_view(self):
article = ArticleFactory(title=u'Zog Zog chez les schtroumphs', article = ArticleFactory(title=u'Zog Zog chez les schtroumphs',
lang='FR') lang='FR',
archive=False,
status='PUBLISHED')
article.save() article.save()
r = self.client.get('/rp/', {'q': 'Zog Zog'}) r = self.client.get('/rp/', {'q': 'Zog Zog'})
...@@ -131,7 +133,9 @@ class TestArticleViews(TestCase): ...@@ -131,7 +133,9 @@ class TestArticleViews(TestCase):
assert len(r.context['article_list']) == 0 assert len(r.context['article_list']) == 0
def test_search_view_archived(self): 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'}) r = self.client.get('/rp/', {'q': '', 'archive': 'true'})
assert len(r.context['article_list']) == 1 assert len(r.context['article_list']) == 1
...@@ -141,7 +145,10 @@ class TestArticleViews(TestCase): ...@@ -141,7 +145,10 @@ class TestArticleViews(TestCase):
assert len(r.context['article_list']) == 0 assert len(r.context['article_list']) == 0
def test_search_view_speaks(self): 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'}) r = self.client.get('/rp/', {'q': '', 'speak': 'true'})
assert len(r.context['article_list']) == 1 assert len(r.context['article_list']) == 1
...@@ -151,7 +158,10 @@ class TestArticleViews(TestCase): ...@@ -151,7 +158,10 @@ class TestArticleViews(TestCase):
assert len(r.context['article_list']) == 0 assert len(r.context['article_list']) == 0
def test_search_view_quoted(self): 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'}) r = self.client.get('/rp/', {'q': '', 'quote': 'true'})
assert len(r.context['article_list']) == 1 assert len(r.context['article_list']) == 1
......
...@@ -138,9 +138,10 @@ class ArticleDetailView(LoginRequiredMixin, DetailView): ...@@ -138,9 +138,10 @@ class ArticleDetailView(LoginRequiredMixin, DetailView):
return context return context
class ArticleEdit(PermissionRequiredMixin, UpdateView): class ArticleEdit(LoginRequiredMixin, PermissionRequiredMixin, UpdateView):
model = Article model = Article
permission_required = 'rp.can_edit' permission_required = 'rp.can_edit'
raise_exception = True
fields = ['screenshot', 'url', 'lang', 'title', 'tags', 'extracts', fields = ['screenshot', 'url', 'lang', 'title', 'tags', 'extracts',
'quote', 'speak', 'archive'] 'quote', 'speak', 'archive']
......
Markdown is supported
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