[Fixed]-Django: after submitting the form, why the redirected url is an empty page

1👍

As mentioned in the comments the correct parameter to pass to reverse() is ‘result’, i.e the name of the url.

If you’re using django 1.7 or higher you can skip the reverse part and django will do it automatically for you.

def input(request):
if request.method == 'POST':
    form = Inputform(request.POST)
    if form.is_valid():
        cd = form.cleaned_data
        print (cd['company'])
        form.save()
        return redirect('result')

should work for you

Leave a comment