No, I meant like this:
def Contact(request):
if request.method == 'POST':
form = ContactUsForm(request.POST)
if form.is_valid():
form.save()
context = {'form': form}
return redirect('contactus.html')
else:
form = ContactUsForm()
return render(request, 'contactus.html', {'form': form})
Also - the redirect should go to a valid django route - What is the route that you want to redirect to after a successful posting?
Another thing you should also look into is using class based views instead of function based views, because then you don't need to write as much code - but get this working first! :-)
you mean i should have it like this
def Contact(request):
if request.method == 'POST':
form = ContactUsForm(request.POST)
if form.is_valid():
form.save()
context = {'form': form}
return redirect('contactus.html')
else:
form = ContactUsForm()
return( 'contactus.html', ) or .....