On Sat, Aug 1, 2009 at 6:59 PM, prabhu S<prabhu...@gmail.com> wrote:
>
> change student_id_validate to student_id_check
>
> Invalid variable dude.
>
> On Aug 2, 12:46 am, cprsystems <cprsyst...@gmail.com> wrote:
>> I'm trying to redirect users of an html page to another page depending
>> on the user id entered. I'm using if else statements and declaring ids
>> within views.py named htmlp2. I keep getting syntax errors, any
>> insight as to why would be much appreciated. My code is below
>>
>> Thank you
>>
>> from django.shortcuts import render_to_response
>> import datetime
>>
>> def htmlp1(request):
>>     now = datetime.datetime.now()
>>     return render_to_response('page-one.html', locals())
>>
>> def htmlp2(request):
>>     dan_id = 1234567
>>     stu_id = 7654321
>>     student_id_check = request.GET['student_id']
>>     if student_id_validate == dan_id:
>>         return render_to_response('page-two', locals())
>>     elif: student_id_validate == stu_id:
>>         return render_to_response('page-three', locals())
>>     else:
>>         return render_to_response('page-one', locals())
>>
>> ERROR INFO
>>
>> SyntaxError at /htmlp1/
>>
>> ('invalid syntax', ('C:\\dantest\\..\\dantest\\views.py', 14, 9, '
>> elif: student_id_validate == stu_id:\n'))
>>
>> Request Method:         GET
>> Request URL:    http://127.0.0.1:8000/htmlp1/
>> Exception Type:         SyntaxError
>> Exception Value:
>>
>> ('invalid syntax', ('C:\\dantest\\..\\dantest\\views.py', 14, 9, '
>> elif: student_id_validate == stu_id:\n'))
>>
>> Exception Location:     C:\dantest\..\dantest\urls.py in <module>, line 3
>> Python Executable:      C:\Python26\python.exe
>> Python Version:         2.6.2
>> Python Path:    ['C:\\dantest', 'C:\\Python26\\python26.zip', 'C:\
>> \Python26\\DLLs', 'C:\\Python26\\lib', 'C:\\Python26\\lib\\plat-win',
>> 'C:\\Python26\\lib\\lib-tk', 'C:\\Python26', 'C:\\Python26\\lib\\site-
>> packages']
>> Server time:    Sat, 1 Aug 2009 18:39:31 -0500
> >
>

You have a colon after elif that shouldn't be there, you just need the
one at the end of the line.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you
want" -- Me

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

Reply via email to