== Adding an ajax login form to your project == Assuming you have a project running and using the normal authentification scheme providen by django, it would be nice not to reload the page to show errors about login and password when the login is wrong. We need to add a specific method to your application's view.py for this example we will call the method '''loginajax'''. We simply do a copy / past from '''/django/contrib/auth/view.py''' method login. we just change the return values. {{{ #!python def loginajax(request): manipulator = AuthenticationForm(request) redirect_to = request.REQUEST.get(REDIRECT_FIELD_NAME, '') if request.POST: errors = manipulator.get_validation_errors(request.POST) if not errors: if not redirect_to or '://' in redirect_to or ' ' in redirect_to: redirect_to = '/accounts/profile/' request.session[SESSION_KEY] = manipulator.get_user_id() request.session.delete_test_cookie() return HttpResponse(redirect_to) else: return HttpResponse("false") }}} Now let change our '''ur.py''' You shoudl still keep the normal one r^login/$ and add the new one. {{{ #!python [..] (r'^login/$', 'django.contrib.auth.views.login'), (r'^login/ajax/$', 'cefinban.views.loginajax'), [...] }}} We then need to add the dojo magic to our login page. id = loginForm refer to our