Currently I'm doing this and it works as expected:
controller:
items =db().select(db.t_items.ALL,cache=(cache.ram,10),cacheable=True)
return dict(items=items)
view:
{{for item in items:}}
{{if item.f_item_category == int(request.args(0)):}}
displays items belonging to a specific category only
I didn't find out yet how to filter it right in the controller.:
These don't work:
items =db().select(db.t_item.f_item_category == int(request.args(0)))
error: <type 'exceptions.TypeError'>(int() argument must be a string or a
number, not 'NoneType')
items =db().select(db.t_items.f_item_category == 14)
error: <type 'exceptions.AttributeError'>('Query' object has no attribute
'type')
items =db().select(db.t_items.id==4)
error: <type 'exceptions.AttributeError'>('Query' object has no attribute
'type')
So what is the right format?
Thanks.
On Sunday, September 1, 2013 12:25:32 AM UTC+3, אבי אברמוביץ wrote:
>
> Hi,
> I do this query:
> items = db.executesql('SELECT * FROM project;')
> For the field below, which is a field in the db.project:
> Field('company_name', 'reference company', notnull=True).
> On the view, "{{=item[3]}}" renders only '1'.(instead of the company name).
> What should I do?
> Thanks.
>
--
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.