hi
currently i am doing car rental website and one of my update booking function encounter some problem which i also do not know where is wrong. basically i would to check through my Booking1 table if the id user posted over equal to any id in my Booking1 table. if exist, then we will let it proceed otherwise it will go to Notexist page
to state to customer that this booking id do not exist. my code is in the following yet i don not why every time, it just go into else condition, even though my "if i.id == q:" condition is fulfilled. is this indention error or....syntax error. can anyone kindly help me with this. thanks in advance. :)
[code=python]
def confirmUp(reque st):
Array=[]
ba={}
q=request.sessi on['BK_id']
uID=request.use r.id
#ba=Booking1.ob jects.get(id=q)
#print ba.id
for i in Booking1.object s.all():
if i.id == q:
print "PPPPPPPPP"
ba=Booking1.obj ects.get(id=q)
print "LLLLLLLLLLLLLL LL"
Array.append(ba )
return render_to_respo nse('proceed.ht ml',{'Array': Array })
else:
return HttpResponseRed irect("/Notexist/")
[/code]
currently i am doing car rental website and one of my update booking function encounter some problem which i also do not know where is wrong. basically i would to check through my Booking1 table if the id user posted over equal to any id in my Booking1 table. if exist, then we will let it proceed otherwise it will go to Notexist page
to state to customer that this booking id do not exist. my code is in the following yet i don not why every time, it just go into else condition, even though my "if i.id == q:" condition is fulfilled. is this indention error or....syntax error. can anyone kindly help me with this. thanks in advance. :)
[code=python]
def confirmUp(reque st):
Array=[]
ba={}
q=request.sessi on['BK_id']
uID=request.use r.id
#ba=Booking1.ob jects.get(id=q)
#print ba.id
for i in Booking1.object s.all():
if i.id == q:
print "PPPPPPPPP"
ba=Booking1.obj ects.get(id=q)
print "LLLLLLLLLLLLLL LL"
Array.append(ba )
return render_to_respo nse('proceed.ht ml',{'Array': Array })
else:
return HttpResponseRed irect("/Notexist/")
[/code]
Comment