hi,

how to put query in sqlform.grid or smartgrid?

*code*
def category():
    query=db.category
    grid=SQLFORM.smartgrid(query)
    return locals()

i want to make a query for example db.category.id > 10, and i don't know 
how to do it, is there any hints or reference for this?
when i tried to replace the query=db.category.id > 10 it will return an 
error :

Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.

Traceback (most recent call last):
  File "/home/stifank/Desktop/web2py/gluon/restricted.py", line 212, in 
restricted
    exec ccode in environment
  File 
"/home/stifank/Desktop/web2py/applications/rental/controllers/default.py" 
<http://127.0.0.1:8000/admin/default/edit/rental/controllers/default.py>, line 
152, in <module>
  File "/home/stifank/Desktop/web2py/gluon/globals.py", line 193, in <lambda>
    self._caller = lambda f: f()
  File "/home/stifank/Desktop/web2py/gluon/tools.py", line 2942, in f
    return action(*a, **b)
  File 
"/home/stifank/Desktop/web2py/applications/rental/controllers/default.py" 
<http://127.0.0.1:8000/admin/default/edit/rental/controllers/default.py>, line 
90, in booking
    grid=SQLFORM.smartgrid(query)
  File "/home/stifank/Desktop/web2py/gluon/sqlhtml.py", line 2454, in smartgrid
    if request.args(len(args)) != table._tablename:
AttributeError: 'Query' object has no attribute '_tablename'

Error snapshot [image: 
help]<http://127.0.0.1:8000/admin/default/ticket/rental/127.0.0.1.2013-03-07.09-47-49.5e19acec-adc5-410c-b3ad-0df5e5e6924e#>

<type 'exceptions.AttributeError'>('Query' object has no attribute 
'_tablename')


thank you so much before

-- 

--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to