newmediamonitoring/polls/decorators.py

12 lines
309 B
Python

from django.http import HttpResponse
def polls_login_required(function):
def wrapper(request, *args, **kwargs):
u = request.user
if not u.is_authenticated:
return HttpResponse(status=401)
else:
return function(request, *args, **kwargs)
return wrapper