Saturday, June 30, 2012

Re: i want to display a student profile from the database and am unable to do that.plz help

hii..thanks for your concern friend....i did not able to get your point......can you please tell this in little more brief....actually i want to enter the roll number from the user and then that number could filter the data from the database and display the whole profile of the student..

On Sun, Jul 1, 2012 at 1:12 AM, Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote:
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.


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