def passchange(request): if request.user.is_authenticated: if request.method == "POST": print(request.POST) fm = PasswordChangeForm(user=request.user, data=request.POST) print(fm) if fm.is_valid(): fm.save() update_session_auth_hash(request, fm.user) messages.success(request, 'Password Changed Successfully') if fm.user.location=="Latur": return HttpResponseRedirect('/laturhome/') elif fm.user.location=="Nashik": return HttpResponseRedirect('/nashikhome/') elif fm.user.location=="Dhule": return HttpResponseRedirect('/dhulehome/') elif fm.user.location=="Akola": return HttpResponseRedirect('/akolahome/') elif fm.user.location=="Solapur": return HttpResponseRedirect('/solapurhome/') else: print(fm.error_messages) return HttpResponse('Not valid') else: fm = PasswordChangeForm(user=request.user) return render(request, 'account/passchange.html', {'form':fm}) else: return HttpResponseRedirect('/login/')
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)