Home > Mobile >  Django views. Py why get less than the value of the user, such mistakes & # x27; Method & # x27; The
Django views. Py why get less than the value of the user, such mistakes & # x27; Method & # x27; The

Time:12-03

views. Py content:
Def login (request) :
. If the request method=="GET" :
Return render (request, "login. HTML")
The else:
Print (request. POST)
U=request. POST. Get (" user ")
P=request. POST. Get [" PWD "]
If u==(" root ") and p==(" 123 ") :
# login success
Return an HttpResponse (" login succeeds ")
The else:
Return render (request, "login. HTML")
Return render (request, "login. HTML")


login. HTML content:



<meta charset="utf-8" & gt;
Title

<body>

{% csrf_token %}


Immediately registered & lt;/a>

{{calresult}} & lt;/p>



  • Related