Guest User

Untitled

a guest
May 25th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.14 KB | None | 0 0
  1. def sign_in(request):
  2.         """
  3.        Controls a view.
  4.        """
  5.  
  6.         if request.method == "POST":
  7.                 user = AUTHENTICATE(username = request.POST["username"],
  8.                                     password = request.POST["password"])
  9.                 if user:
  10.                         LOGIN(request, user)
  11.                         next_    = request.GET.get("next", "/my_phil4")
  12.                         response = REDIRECT(next_)
  13.                 else:
  14.                         response = REDIRECT("/sign_in")
  15.         else:
  16.                 form         = django.contrib.auth.forms.AuthenticationForm()
  17.                 current_page = sys._getframe(0).f_code.co_name
  18.                 current_year = datetime.date.today().year
  19.                 response     = RESPONSE(request,
  20.                                         "sign_in.html",
  21.                                         {"form"         : form,
  22.                                          "menu_items"   : MENU_ITEMS,
  23.                                          "current_page" : current_page,
  24.                                          "current_year" : current_year})
  25.  
  26.         return response
Add Comment
Please, Sign In to add comment