>
> workers = db(db.worker.w_organisation == 10).select(db.worker.w_id_w, 
> db.worker.w_organisation, db.worker.w_first_name, 
> db.worker.w_last_name,db.worker.w_nick_name,db.worker.w_email,db.worker.w_status,db.worker.w_note).as_list()
>

What is the above for? It is not used below.
 

> #Define the query object. Here we are pulling all contacts having date of 
> birth less than 18 Nov 1990
> query = ((db.worker.w_organisation == 10) )#& 
> (db.worker.w_status==db.status.s_id_s))
>

Why are you defining this query? Based on your model, looks like 
db.status.s_id_s should just be db.status.id. Also, not clear how this 
query selects based on birth date.
 

>   fields = (db.worker.w_id_w,db.worker.w_first_name, 
> db.worker.w_last_name,db.worker.w_nick_name,db.worker.w_email
> *,db.status.s_code*,db.worker.w_note)
>

Note, smartgrid is for browsing one table at a time (and linking to 
referencing tables), so you do not include fields from multiple tables in 
the same grid. According to the book:


*A SQLFORM.smartgrid looks a lot like a grid, in fact it contains a grid 
but it is designed to take as input not a query but only one table and to 
browse said table and selected referencing tables.*
 
If you want to include some extra columns, you can do so via the "links" 
argument, which can be a dict with table names as the keys so you can 
specify different links for each table.

form = SQLFORM.smartgrid(db.worker,fields = fields,headers= 
> headers,linked_tables=['status'])
>

Note, db.status is not a child of db.worker -- it's the opposite -- there 
is a one-to-many relationship from db.status to db.worker. So, specifying 
linked_tables=['status'] will have no effect. On the other hand, if you do 
SQLFORM.smartgrid(db.status, linked_tables=['worker']), each row of the 
status grid will include a column with a "Workers" link to display a grid 
of the workers associated with a given status.

Anthony
 

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

Reply via email to