newmediamonitoring/polls/decorators.py

10 lines
318 B
Python
Raw Normal View History

2020-09-03 04:03:19 +00:00
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