newmediamonitoring/polls/decorators.py

10 lines
318 B
Python

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