I have a form that should redirect to another view function called content to predict. I receive an error saying that the form doesn't exist when it does as shown in my code:
def content_to_predict(request):
if request.method == "POST":
form = InputForm(request.POST)
if form.is_valid():
return redirect('content_to_predict')
else:
form = InputForm()
return render(request, 'prediction/content_input.html', {'form': form})
def show_prediction_result(request):
return HttpResponse('hello')
What's the problem?
Figured it out. Instead of using redirect, just make a call to another function itself by:
return show_prediction_result(request)
I can't say one way or another as to why redirect doesn't work. If anyone has any input in regards to that. I'd appreciate it.