Force django not to redirect after password change?

Maybe this is a stupid question. I have a simple Django app and when I change the password (success or not) I want to stay on the same page (I wanna manage with JS the messages). So I no wanna redirect at all at path (password_change/done). Is this possible?

This is the views file that I tried, I tried to return None hoping it will work.

@login_required
def ChangePassword(request):
    form = ChangePasswordForm(request.POST or None)
    if form.is_valid():
        form.save()
        messages.success(request, 'Your password was successfully updated!')
    else:
        messages.error(request, 'something happened!')
Back to Top