Django: Staff Decorator
- by Mark
I'm trying to write a "staff only" decorator for Django, but I can't seem to get it to work:
def staff_only(error='Only staff may view this page.'):
def _dec(view_func):
def _view(request, *args, **kwargs):
u = request.user
if u.is_authenticated() and u.is_staff:
return view_func(request, *args,…