1👍
✅
Base on your description and views.py, you stay on step 2 that’s why:
- User is on page ‘/step_1/’
- He submit form
- Because action param in form is point to ‘/step_2/’, it’s going to that url
- In view request.method == ‘POST’ is True, but form is not valid.
- You are rendering template from ‘/step_1’, but not redirecting User.
So here is sample fix:
def step2(request):
print(request.POST)
if request.method == 'POST':
form = SearchShowForm(request.POST)
if form.is_valid():
print(form.cleaned_data)
return render(request, 'tvshows_manager/step_2.html', {'data': form.cleaned_data})
else:
return HttpResponseRedirect('/step_1/')
else:
return HttpResponseRedirect('/step_1/')
Source:stackexchange.com