Monday, October 1, 2012

The view didn't return an HttpResponse object.

I made a model form and a view which accepts input as a form and
display it in the html format. As when i refresh the html page or try
to fill another entry in the form, it gives the following error:

The view Automation.report.views.chemical_analysis didn't return an
HttpResponse object.

Here is the views that creates this problem:
def chemical_analysis(request):
if request.method=='POST':
form = chem_analysisForm(request.POST)
if form.is_valid():
cd = form.cleaned_data
form.save()
chem = chem_analysis.objects.all()
#return HttpResponseRedirect(chem)
return render_to_response('report/chemical_analysis.html',
{'chem': chem,},context_instance=RequestContext(request))

else:
form = chem_analysisForm()
return render_to_response('report/report.html', {"form":form},
context_instance=RequestContext(request))

Any help regarding this will be highly appreciated.

--
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment