Wednesday, July 4, 2012

Re: view didn't return an HttpResponse object....plz help

The only condition where this view wont return an HTTPResponse is when request.method == 'POST' is True and form.is_valid() is False.

In this condition the outer if condtion would complete execution and exit out since inner if condition is False and wont enter inner if condition.

I think you should move out the return statement from the else loop.

On Thursday, July 5, 2012 10:43:29 AM UTC+5:30, rick wrote:

i want to filter roll no from database,but when i enter the number ,browser gives view didn't return an HttpResponse object ....this is my view..

def studentid(request):
    if request.method == 'POST':
        form = Student_loginForm(request.POST)
        if form.is_valid():
            cd = form.cleaned_data
            rollno = cd[rollno]
            rollno = request.POST.get(rollno)
            results = Add_record.objects.filter(Student_ID=rollno)
            return HttpResponseRedirect(reverse('record_system.views.search' ,args=(results,)))
    else:
        form = Student_loginForm
        return render_to_response('add_record/studentid.html', context_instance=RequestContext(request))


please help...
thanks in advance.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/6178-1cjLacJ.
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate