Skip to content Skip to sidebar Skip to footer

Django Says "didn't Return An Httpresponse Object. It Returned None Instead."

I was looking for solutions on stack, but none did helped me. The most solutions were indent-related, but I think mine is not. I'll appreciate it when someone can help me out with

Solution 1:

Please check now, In get request you were not returning anything,

def get_question(request):
    if request.method == 'POST':
        form = QuestionPostForm(request.POST)
        if form.is_valid():
            obj = QuestionPost()
            obj.question = form.cleaned_data['question']
            obj.tag = form.cleaned_data['tag']
            obj.save()
            return HttpResponseRedirect('forum/index.html',{'form':form})

    else:
        form = QuestionPostForm()
    return render_to_response(request, 'forum/index.html', {'form': form})

Post a Comment for "Django Says "didn't Return An Httpresponse Object. It Returned None Instead.""