diff --git a/smash/smash/settings.py b/smash/smash/settings.py index cff7e49c181cd560f49f697db923b53d393c08b2..859e8624cbe8def8ed70b4ad96ff946ba60fc683 100644 --- a/smash/smash/settings.py +++ b/smash/smash/settings.py @@ -101,4 +101,8 @@ USE_TZ = True STATIC_URL = '/static/' MEDIA_URL = '/media/' +# Used for @login_required ecosystem +LOGIN_URL = '/login' +LOGOUT_URL = '/logout' + from local_settings import * diff --git a/smash/web/api_views.py b/smash/web/api_views.py index b59798f226642f552ae11cd2753bfe5c779ef390..64d6e2eefdfdcf26d38fa0abae84ef0a39f5c563 100644 --- a/smash/web/api_views.py +++ b/smash/web/api_views.py @@ -1,8 +1,10 @@ from .models import * from .forms import * +from django.contrib.auth.decorators import login_required from django.http import JsonResponse + def cities(request): X = Subject.objects.filter(city__isnull=False).values_list('city').distinct() return JsonResponse({ diff --git a/smash/web/views.py b/smash/web/views.py index b4de10ef88eea1412a94510da46181624cb0f7ab..4bcd4617198cdd297f21320a576daf74f2530f78 100644 --- a/smash/web/views.py +++ b/smash/web/views.py @@ -1,4 +1,5 @@ from __future__ import unicode_literals +from django.contrib.auth.decorators import login_required from django.shortcuts import redirect, render from django.http import HttpResponse from django.template import loader @@ -59,6 +60,7 @@ def login(request): """ Saturates response with information about logged user """ +@login_required def wrap_response(request, template, params): person, role = Worker.get_details(request.user)