[Fixed]-Django form.py not updating

1👍

Looks like your forget to render response inside your view.
Also you need to include form into context to render template right.

Try to change view as follow:

def contact(request):
    # if this is a POST request we need to process the form data
    if request.method == 'POST':
        # create a form instance and populate it with data from the request:
        form = ContactForm(request.POST)
        # check whether it's valid:
        if form.is_valid():
            # process the data in form.cleaned_data as required
            # ...
            # redirect to a new URL:
            return HttpResponseRedirect('/message_recived/')
    else:
        form = ContactForm()       
    return render(request, 'contact.html', {'form': form}) 

Leave a comment