1 from django.contrib.auth import authenticate, login, logout
2 from django.shortcuts import redirect, render
3 from django.contrib.auth.forms import AuthenticationForm
4 from django_simple.todo.models import Task
5 from lazysignup.decorators import allow_lazy_user
8 def logout_view(request):
12 def login_view(request,authentication_form=AuthenticationForm):
13 username = password = ''
15 username = request.POST['username']
16 password = request.POST['password']
18 user = authenticate(username=username, password=password)
23 form = authentication_form(request)
24 return render(request, 'registration/login.html', {'form':form})
27 def add1(request,authentication_form=AuthenticationForm):
28 if request.method == 'POST':
29 form = TaskForm(request.POST)
31 name = form.cleaned_data["name"]
33 task = Task(name=name,owner=user,ready=False)
35 return redirect('add_min',task_id=task.id)
36 form = authentication_form(request)
37 return render(request, 'registration/login.html', {'form':form})