On Sat, 30 Jun 2012 11:54:35 -0700 (PDT), rick
<manishgirdhar88@gmail.com> declaimed the following in
gmane.comp.python.django.user:
>
> this is my views.py.
>
> def studentid(request):
> if request.method == 'POST':
> form = Student_loginForm(request.POST)
> if form.is_valid():
> cd = form.cleaned_data
> rollno = cd['rollno']
> p = form.save()
> rollno = request.POST.get('rollno')
> rollno=int(rollno)
> results = Add_record.objects.filter(Student_ID=rollno)
> return HttpResponseRedirect(reverse('record_system.views.search',
> args=(results)))
Note: if args is supposed to be a tuple, you need to include a
trailing ,
args = (results, )
Otherwise, each item (if there are more than one) in results is
being treated as a separate positional argument.
Other than that minor syntactic nit, one may need to see
"Add_record"...
Also, what is the expected behavior if .is_valid() comes back false?
As coded, regardless of the .is_valid() return, you appear to fetch
"rollno" from the request object (replacing any value saved from the
clean data branch).
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
--
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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment