I'm new to web2py, and Python. I created a database, and I want to create a
page where I can return records from a table of people, using their first
and last names as search terms. What I have so far is:
def patient_lookup():
#form = SQLFORM.grid(db.consumer, deletable = True)
form=SQLFORM.factory(
Field('Lname', requires=IS_IN_SET(consumer)),
Field('Fname', requires=IS_IN_SET(consumer)),
submit_button="Search")
if form.accepts(request.vars, session):
consumer=db.consumer(id).select()
return dict(form=form)
My error:
Traceback (most recent call last):
File "/home/mdipierro/make_web2py/web2py/gluon/restricted.py", line 217, in
restricted
File "C:/web2py_src/web2py/applications/facesheet/controllers/default.py",
line 64, in <module>
File "/home/mdipierro/make_web2py/web2py/gluon/globals.py", line 372, in
<lambda>
File "C:/web2py_src/web2py/applications/facesheet/controllers/default.py",
line 38, in patient_lookup
Field('Lname', requires=IS_IN_SET(consumer)),
UnboundLocalError: local variable 'consumer' referenced before assignment
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.