On Friday, October 14, 2016 at 9:35:51 PM UTC-4, Alex Glaros wrote:
> how to supress field header
>    {{taxonomy_set = ['super_city_3', 'super_city_2', 'super_city_1', 
> 'city', 'sub_city_1', 'sub_city_2', 'sub_city_3']}}
>     {{for r in taxonomy_set:}}
>         {{db.geo_political_generic_fields_lookup.taxonomy_column_fk.label 
> = ''}} #does not work

The "label" attribute is used in forms -- not relevant here.

>         {{geoFieldName = 
> db((db.geo_political_generic_fields_lookup.country_fk == specificCountryID) 
> & (db.geo_political_generic_fields_lookup.generic_geo_political_field_name 
> == r)).select(db.geo_political_generic_fields_lookup.taxonomy_column_fk)}}
>         <b>{{=r }}</b>   translates to: {{=geoFieldName}}<br>
>     {{pass}}

The problem is that geoFieldName is the result of a .select(), so it is a 
Rows object -- when you insert a Rows object in a template, you get a 
SQLTABLE (with headings). Instead, you need 
.select(...).render(0).taxonomy_column_fk. The .render(0) extracts the 
record from the Rows object and applies the "represent" attributes of each 
of its fields (in this case, just the taxonomy_column_fk field). If you 
instead did .select(...).first().taxonomy_column_fk, you would get the 
actual foreign key value (i.e., an integer record ID) rather than the 
transformed representation of that foreign key.

Also, I would recommend moving most of that code out of the view -- views 
are for *displaying* data, not creating/generating it. Code in views is 
harder to read and debug.



- 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