Guest User

Untitled

a guest
Nov 25th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. def signin(request):
  2. username = 'not logged in'
  3. notify = ""
  4. if request.method == "POST":
  5. form = signinForm(request.POST)
  6. if form.is_valid():
  7. username = form.cleaned_data['user_name']
  8. password = form.cleaned_data['password']
  9. signup_data = signup.objects.all() # focus here
  10. for data in signup_data:
  11. name = data.user_name
  12. passw = data.password
  13. if name == username and passw == password:
  14. post = form.save(commit=False)
  15. post.save()
  16. request.session['user_name'] = username
  17. return redirect('/home')
  18. notify = "Incorrect User name or Password"
  19. return redirect("/home/signin")
  20. else:
  21. form = signupForm()
  22. signins=blog.objects.all()
  23. number=len(signins)
  24. return render_to_response('blogger/signin.html', {'form':form, 'signins': signins, 'number':number, 'notify': notify}, RequestContext(request))
Add Comment
Please, Sign In to add comment