How about this?

features = []
for event in events:
    link = A(event[db.events.title], _href=URL('default', 'event_page', 
vars=dict(event_id=event[db.events.id]))).xml()    
    item = {
        "type": "Feature",
        "popupContent": link,
        "track_quotation": str(event[db.events.track_quotation]),
        "geometry": loads_json(event[db.events.geometry.st_asgeojson()])
    }
    features.append(item)





On Saturday, 17 September 2016 12:57:29 UTC-5, Gael Princivalle wrote:
>
> Someone have an idea?
>
> Here is the code that works:
>     features= [{"type": "Feature",
>                 "properties": {
>                     "popupContent": "<a href='" +  URL('default', 
> 'event_page', vars=dict(event_id=event[db.events.id])) + "'>" + 
> event[db.events.title] + "</a>",
>                     "track_quotation": 
> str(event[db.events.track_quotation])
>                 },
>                 "geometry": 
> loads_json(event[db.events.geometry.st_asgeojson()])} for event in events]
>
> But I would like to traduce it in a loop like that:
> for event in events:
>     ...
>
> Il giorno martedì 13 settembre 2016 15:36:32 UTC+2, Gael Princivalle ha 
> scritto:
>>
>> Hello.
>>
>> Can someone explain me why when I use this set of rows:
>> events= db(db.events.id>0).select(db.events.id, db.events.title, 
>> db.events.geometry.st_asgeojson())
>> I can't call my rows with event.title but with event[db.events.title] ?
>>
>> It's a problem because if I would like to call for a reference field like 
>> event[db.events.category.category_name] ticket is wrong attribute.
>>
>> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to