In version web2py trunk in 10.10 and mysql ubuntu
If I run this code, everything works fine
def buscar_notas():
form, results = crud.search( db.notas,
query =
(db.notas.id>0)&(db.notas.active==True),
queries = ['equals', 'not equal', 'contains'],
query_labels={'equals':'Igual a','not
equal':'No igual a','contains':'Contiene'},
#fields =
[db.notas.nota,db.notas.folio,db.notas.first_name,db.notas.last_name,db.notas.end_name,
\
#
db.notas.armazon1,db.notas.lente1,db.notas.lc4,db.notas.total,db.notas.anticipo,db.notas.pagos,db.notas.saldo,
\
#
db.notas.vendedor,db.notas.optometrista,db.notas.garantia,db.notas.vale],
field_labels =
{'nota':'Num.Nota','folio':'Num.Folio','first_name':'Nombre(s)','last_name':'Apel.Pater.','end_name':'Apel.Mater.',
\
'armazon1':'Armazon1',
'lente1':'Lente1','lc4':'L/C
4','total':'Total','anticipo':'Anticipo','pagos':'Pagos','saldo':'Saldo',
\
'vendedor':'Vendedor','optometrista':'Optometrista','garantia':'Garantia',
'vale':'Vale'},
zero='Por favor, seleccione al menos una')
return dict(form=form, results=results)
But when I remove the comments, this is the error
Traceback (most recent call last):
File "/home/drayco/web2py/gluon/restricted.py", line 189, in
restricted
exec ccode in environment
File "/home/drayco/web2py/applications/movil/controllers/ventas.py",
line 1092, in <module>
File "/home/drayco/web2py/gluon/globals.py", line 124, in <lambda>
self._caller = lambda f: f()
File "/home/drayco/web2py/gluon/tools.py", line 2373, in f
return action(*a, **b)
File "/home/drayco/web2py/applications/movil/controllers/ventas.py",
line 1089, in buscar_notas
zero='Por favor, seleccione al menos una')
File "/home/drayco/web2py/gluon/tools.py", line 3139, in search
field = table[field]
File "/home/drayco/web2py/gluon/dal.py", line 4323, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: 'notas.nota'
The field to which it refers is defined in the model and database
Any advice on how to make it work?