1from django.contrib.auth import authenticate, login
2from django.contrib.auth.decorators import login_required
3
4
5
6
7EXAMPLE 1 (USED IN VIEW CONTROLLER FUNCTIONS)
8===========
9@login_required
10def profile_general(request):
11 return render(request, 'pages/profile_general.html', {'datax': 'Directoreel'})
12
13
14EXAMPLE 2 (USED IN VIEW CONTROLLER FUNCTIONS)
15===========
16def login_action(request):
17 # login authentication
18 if request.user.is_authenticated:
19 return render(request, 'pages/dashboard.html', {'datax': 'Directoreel'})
20 # back to login page
21 else:
22 pass