我有一個非常基本的視圖,我正在保存表單。出於某種原因,我不斷收到「視圖沒有返回HttpResponse對象」錯誤。我在這裏看到了這個常見問題,但還沒有找到適用於我的解決方案。有人有想法嗎?我已經包含下面的代碼。非常感謝幫助這個簡單的問題!Django「視圖沒有返回HttpResponse對象。」
def EarlyAdopterSignup(request):
f = LandingPageForm(request.POST)
if f.is_valid():
email = f.cleaned_data['email']
zip = f.cleaned_data['zip']
adopter = EarlyAdopter(email = email, zip = zip)
try:
adopter.save()
return render_to_response('EarlyAdopterSignup.html')
except:
return HttpResponse("There was an error with your submission. Please try again.")