Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How to prevent jquery mobile from handling post request with ajax in django
- def login(request):
- if request.method == 'POST':
- username = request.POST['u']
- password = request.POST['p']
- user = authenticate(username=username, password=password)
- if user is not None:
- if user.is_active:
- auth_login(request, user)
- msg.append("Hello %s your login was successful"% username)
- return HttpResponseRedirect('/profile/')
- else:
- msg.append("disabled account")
- else:
- msg.append("invalid login")
- return render_to_response('login.html')
- {% block content %}
- <form action="" method="post">{% csrf_token %}
- Login: <input type="text" name="u">
- <br/>
- Password: <input type="password" name="p">
- <input type="submit" value="Login">
- </form>
- {% if errors %}
- <ul>
- {% for error in errors %}
- <li>{{ error }}</li>
- {% endfor %}
- </ul>
- {% endif %}
- <a href="logout"> Logout </a>
- {% endblock %}
- <script type="text/javascript">
- $(document).bind("mobileinit", function(){
- ajaxEnabled:false;
- });
- </script>
Add Comment
Please, Sign In to add comment