我有一个非常基本的视图来保存表单。出于某种原因,我不断收到“视图未返回 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.")