Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def user_login(request):
- if request.method == 'POST':
- form = LoginForm(request.POST)
- username = request.POST['username']
- password = request.POST['password']
- print "u %s p:%s" % (username, password)
- user = authenticate(username=username, password=password)
- print "Authentication done"
- if user is not None:
- print "logging in"
- login(request, user)
- return HttpResponseRedirect(request.POST['next'])
- else:
- print("The username and password were incorrect.")
- else:
- form = LoginForm()
- return render(request, 'login.html', {'loginForm': form})
- @login_required
- def registration(request):
- dosomething...
- class LoginForm(forms.ModelForm):
- class Meta:
- model = User
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement