Enforce and test TODO_STAFF_ONLY setting

This commit is contained in:
Scot Hacker 2019-01-10 00:39:21 -08:00
parent 6953085285
commit 91b9a099a3
14 changed files with 81 additions and 51 deletions

View file

@ -1,6 +1,6 @@
import bleach
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.decorators import login_required, user_passes_test
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, redirect, render
@ -8,10 +8,11 @@ from django.utils import timezone
from todo.forms import AddEditTaskForm
from todo.models import Task, TaskList
from todo.utils import send_notify_mail
from todo.utils import send_notify_mail, staff_check
@login_required
@user_passes_test(staff_check)
def list_detail(request, list_id=None, list_slug=None, view_completed=False) -> HttpResponse:
"""Display and manage tasks in a todo list.
"""