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 received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---