Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
The view didn't return an HttpResponse object.
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Satinderpal Singh  
View profile  
 More options Oct 1 2012, 6:38 am
From: Satinderpal Singh <satinder.goray...@gmail.com>
Date: Mon, 1 Oct 2012 16:06:44 +0530
Local: Mon, Oct 1 2012 6:36 am
Subject: 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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tom Evans  
View profile  
 More options Oct 1 2012, 6:57 am
From: Tom Evans <tevans...@googlemail.com>
Date: Mon, 1 Oct 2012 11:57:34 +0100
Local: Mon, Oct 1 2012 6:57 am
Subject: Re: The view didn't return an HttpResponse object.
On Mon, Oct 1, 2012 at 11:36 AM, Satinderpal Singh

If the request method is POST, but the form is not valid, then no
response is returned. You must return a response from every code path.

Cheers

Tom


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Satinderpal Singh  
View profile  
 More options Oct 1 2012, 7:12 am
From: Satinderpal Singh <satinder.goray...@gmail.com>
Date: Mon, 1 Oct 2012 16:41:15 +0530
Local: Mon, Oct 1 2012 7:11 am
Subject: Re: The view didn't return an HttpResponse object.
On Mon, Oct 1, 2012 at 4:27 PM, Tom Evans <tevans...@googlemail.com> wrote:
> On Mon, Oct 1, 2012 at 11:36 AM, Satinderpal Singh
> <satinder.goray...@gmail.com> wrote:

I add the following to my code,

                            else:
                                return HttpResponse("There was an error with your
submission. Please try again.")

>>                 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.

> If the request method is POST, but the form is not valid, then no
> response is returned. You must return a response from every code path.

Thanks, it works and now gives the error message, can you please tell
me that why the input values are not saved in the database and it
gives only the error message. Point me where i am wrong.

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tom Evans  
View profile  
 More options Oct 1 2012, 7:20 am
From: Tom Evans <tevans...@googlemail.com>
Date: Mon, 1 Oct 2012 12:20:23 +0100
Local: Mon, Oct 1 2012 7:20 am
Subject: Re: The view didn't return an HttpResponse object.
On Mon, Oct 1, 2012 at 12:11 PM, Satinderpal Singh

The form is not valid; check the data you are submitting and the form
definition to see why. The invalid form object itself will specify why
it is invalid, see the docs:

https://docs.djangoproject.com/en/1.4/topics/forms/#using-a-form-in-a...
https://docs.djangoproject.com/en/1.4/ref/forms/api/#using-forms-to-v...

Cheers

Tom


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Babatunde Akinyanmi  
View profile  
 More options Oct 1 2012, 7:28 am
From: Babatunde Akinyanmi <tundeba...@gmail.com>
Date: Mon, 1 Oct 2012 12:27:28 +0100
Local: Mon, Oct 1 2012 7:27 am
Subject: Re: The view didn't return an HttpResponse object.
Its possible that when you refresh the form and the POST request gets
submitted, the form doesn't pass the form.is_valid() if conditional.
In your code, you didn't make any provision for when the form fails
the is_valid() test and from your code, execution stops once
is_valid() returns False so I **guess** that's where the problem lies.

Try re-rendering the submitted form if is_valid is False or doing a redirect.

On 10/1/12, Satinderpal Singh <satinder.goray...@gmail.com> wrote:

--
Sent from my mobile device

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Babatunde Akinyanmi  
View profile  
 More options Oct 1 2012, 7:30 am
From: Babatunde Akinyanmi <tundeba...@gmail.com>
Date: Mon, 1 Oct 2012 12:28:53 +0100
Local: Mon, Oct 1 2012 7:28 am
Subject: Re: The view didn't return an HttpResponse object.
Oooops. I see the question has already been answered. My phone didn't
get the update on time.

On 10/1/12, Babatunde Akinyanmi <tundeba...@gmail.com> wrote:

--
Sent from my mobile device

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Satinderpal Singh  
View profile  
 More options Oct 1 2012, 7:35 am
From: Satinderpal Singh <satinder.goray...@gmail.com>
Date: Mon, 1 Oct 2012 17:04:22 +0530
Local: Mon, Oct 1 2012 7:34 am
Subject: Re: The view didn't return an HttpResponse object.
On Mon, Oct 1, 2012 at 4:58 PM, Babatunde Akinyanmi
<tundeba...@gmail.com> wrote:
> Oooops. I see the question has already been answered. My phone didn't
> get the update on time.

No worries, Thanks anyways

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

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »