0
나는 양식을 제출 때 HttpResponse에 객체를 반환하지 않습니다에 대한 다음과 같은 오류를 잡하고있다 "는 HttpResponse에 객체를 반환하지 않았습니다"왜 난 정말 이해할 수 없다 : 여기 장고 :보기
Exception Type: ValueError at /contact/addcontact
Exception Value: The view openshift.contactapplication.views.contact didn't return an HttpResponse object.
내이다 :
# Create your views here.
from django.shortcuts import render_to_response, render
from django.http import HttpResponseRedirect, HttpResponse
#forms imports
from contactapplication.forms import applicantsForm
#model imports
from contactapplication.models import applicantsModel
def contact(request):
if request.method == 'POST':
form = applicantsForm(request.POST)
if form.is_valid():
clean_form =form.cleaned_data
collect = applicantsModel(first_name=clean_form['first_name'], last_name=clean_form['last_name'],
linkedin_profile=clean_form['linkedin_profile'], elevator_pitch=clean_form['elevator_pitch'],
email=clean_form['email'], phone=clean_form['phone'])
collect.save()
return HttpResponseRedirect('contactUs/contactUs.html') #the same page, change to thankyou page later
else:
return render(request, 'contactUs/contactUs.html',)
무엇이 문제 일 수 있습니까? 명확하게 반환 중입니다 HttpResponseRedirect
지적 해 주셔서 고맙습니다. 그리고 네, 올바르게 읽었습니다. – ApathyBear