##// END OF EJS Templates
Add modules for interactive plots and upload data
Add modules for interactive plots and upload data

File last commit:

r2:98d277d09dd7
r2:98d277d09dd7
Show More
views.py
37 lines | 1.1 KiB | text/x-python | PythonLexer
Add modules for interactive plots and upload data
r2 from django.contrib.auth import authenticate
from django.contrib.auth import login, logout
from django.contrib.auth.forms import AuthenticationForm
from django.shortcuts import render, redirect
''' Login to updata app for ROJ staff'''
def login_view(request):
form = AuthenticationForm()
if request.method == "POST":
form = AuthenticationForm(data=request.POST)
if form.is_valid():
username = form.cleaned_data['username']
password = form.cleaned_data['password']
user = authenticate(username=username, password=password)
if user is not None:
if user.is_active:
login(request, user)
return redirect('/updata')
else:
return render(request, "login/login.html" )
else:
context = {'error_login': "error"}
return render(request, "login/login.html", context )
return render(request, "login/login.html", {'form': form})
def logout_view(request):
logout(request)
return redirect('/')