From f35a7925c5dd12d99d32343b2a2acd6db9b57618 Mon Sep 17 00:00:00 2001 From: Jorran de Wit <jorrandewit@outlook.com> Date: Wed, 7 Jun 2017 21:07:13 +0200 Subject: [PATCH] Stop unexcepted 403 error for unauthorized users --- commentaries/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commentaries/views.py b/commentaries/views.py index 3dc877847..f6153335f 100644 --- a/commentaries/views.py +++ b/commentaries/views.py @@ -1,6 +1,6 @@ from django.shortcuts import get_object_or_404, render from django.contrib import messages -from django.contrib.auth.decorators import permission_required +from django.contrib.auth.decorators import login_required, permission_required from django.core.mail import EmailMessage from django.core.urlresolvers import reverse, reverse_lazy from django.db.models import Q @@ -17,16 +17,17 @@ from .forms import DOIToQueryForm, ArxivQueryForm, VetCommentaryForm, RequestCom from comments.models import Comment from comments.forms import CommentForm -from scipost.models import Contributor import strings +@login_required @permission_required('scipost.can_request_commentary_pages', raise_exception=True) def request_commentary(request): return render(request, 'commentaries/request_commentary.html') +@method_decorator(login_required, name='dispatch') @method_decorator(permission_required( 'scipost.can_request_commentary_pages', raise_exception=True), name='dispatch') class RequestCommentary(CreateView): -- GitLab