python - How to post data via form HTML? -


i want post data server via form. how can this?

<div class="panel-body">     <form role="form" action="{% url 'login' %}" method="post">         {% csrf_token %}         <div class="form-group">             <label for="sender-email" class="control-label">username:</label>             <div class="input-icon"> <i class="icon-user fa"></i>                 <input id="sender-email" type="text" placeholder="username" class="form-control email">             </div>         </div>         <div class="form-group">             <label for="user-pass" class="control-label">password:</label>             <div class="input-icon"> <i class="icon-lock fa"></i>                 <input type="password" class="form-control" placeholder="password" id="user-pass">             </div>         </div>         <div class="form-group">             <input class="btn btn-primary btn-block" id="authenticate_user" type="submit" value="submit">         </div>     </form> </div> 

my views.py

@csrf_exempt def signin(request):     if request.method == 'post':         print request.post.get('sender-email') #prints none         username = request.post['username'] # throws error, username not available.         password = request.post['password'] 

how post data without using jquery? know of way of posting through ajax jquery, dont wanna that.

the 'name' attribute of input tags set keys of request.get , request.post.

add name attribute input tags.

<input name="username" id="sender-email" type="text" placeholder="username" class="form-control email">  <input name="password" type="password" class="form-control" placeholder="password" id="user-pass" > 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -