6.7.2012 13:18, manish girdhar kirjoitti:
so sorry friend..am new to the django and am unable to catch your
point...can you please describe this with example or with my code..thank
you..
[Snip snip with binary scissors]
Problem is that there is two problem points:
Your view doesn't have "default path" so
IF request.method is POST and IF form.is_valid is FALSE your code
doesn't return anything.
This means that your view will return something only if request.method
is not POST (return render_to_response(...) is called) or if
request.method is POST and form.is_valid() is true (return
HttpResponseRedirect(..) is called)
Simplest way to fix it is to indent last "return render_to_response..."
one level outer (same level as if request.method == 'POST' and last
else) making it to be executed if request.method is not POST or if
form.is_valid() is false.
In short form:
def studentid(request):
if request.method == 'POST'
form = Student_loginForm(request.POST)
if form.is_valid():
return HttpResponseRedirect(...)
else:
form = Student_loginForm()
return render_to_response('add_record/studentid.html', ...)
--
Jani Tiainen
- Well planned is half done and a half done has been sufficient before...
--
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+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.