>
> {{for data in list:}}

<tr>
>     <td>{{=data.user_name}}</td>
>     <td>{{=("%(name)s" %data.user_city)}}</td>
>     <td>{{=("%(name)s" %data.user_state)}}</td>


Above, '%(name)s' % data.user_city results in data.user_city.name being 
filled into the string. data.user_city is a DAL Reference object -- it 
stores the ID of the referenced record, but when you do data.user_city.name, 
it does a recursive 
select<http://web2py.com/books/default/chapter/29/06#Recursive-selects>and 
retrieves the value in the "name" field of the referenced record. So, 
the above code will result in two additional db selects for every record in 
"list". If there are a lot of records, you might want to go with the join 
method, which just does a single select.

Anthony

-- 

--- 
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.


Reply via email to