From b2c3f96f8de2d826c462db0e9da022b315ed33c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Mon, 28 Dec 2015 11:03:28 +0100 Subject: [PATCH] =?UTF-8?q?Korektury:=20fix:=20dovol=20p=C5=99=C3=ADstup?= =?UTF-8?q?=20org=C5=AFm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/urls.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/korektury/urls.py b/korektury/urls.py index 8bfd9768..ab6024a4 100644 --- a/korektury/urls.py +++ b/korektury/urls.py @@ -1,10 +1,12 @@ from django.conf.urls import * # NOQA from django.conf.urls import patterns, url -from django.contrib.auth.decorators import permission_required +from django.contrib.auth.decorators import user_passes_test from . import views +staff_member_required = user_passes_test(lambda u: u.is_staff) + urlpatterns = patterns('', - url(r'^korektury/$',permission_required('is_staff')(views.KorekturyListView.as_view()),name='korektury-list'), - url(r'^korektury/(?P\d+)/$', permission_required('is_staff')(views.KorekturyView.as_view()), name='korektury'), - url(r'^korektury/help/', permission_required('is_staff')(views.KorekturyHelpView.as_view()), name='korektury-help'), + url(r'^korektury/$', staff_member_required(views.KorekturyListView.as_view()), name='korektury-list'), + url(r'^korektury/(?P\d+)/$', staff_member_required(views.KorekturyView.as_view()), name='korektury'), + url(r'^korektury/help/', staff_member_required(views.KorekturyHelpView.as_view()), name='korektury-help'), )