good catch. I was writing javascript right now hehehehehe
On Friday, February 26, 2016 at 8:41:38 PM UTC+1, Marty Jones wrote:
>
> Thank you. That works, although using "for" rather than "foreach".
>
> On Friday, February 26, 2016 at 1:35:10 PM UTC-6, Niphlod wrote:
>>
>> the correct syntax would be
>>
>> {{foreach element in elements:}}
>> {{=each}}
>> {{pass}}
>>
>>
>> please read the book (especially the part about views (
>> http://web2py.com/books/default/chapter/29/05/the-views))
>>
>> On Friday, February 26, 2016 at 7:49:07 PM UTC+1, Marty Jones wrote:
>>>
>>> I'm just getting started with web2py and I'm struggling to figure out
>>> how to call variables passed from the controller to the view, without using
>>> the {{=variable}} method.
>>>
>>> For example, I have the following code in my controller:
>>>
>>> def manage():
>>> list = []
>>> for row in db(db.auth_user.registration_key[0]=='p').select():
>>> if row.company=='Chosen company':
>>> list.append({row.last_name:{"first":row.first_name}})
>>> return dict(list=list)
>>>
>>> And the following code in my view:
>>>
>>> {{for each in =list}}
>>> {{print each}}
>>> {{pass}}
>>>
>>> Which generates an error... How do I call the list variable without
>>> using the = syntax?
>>>
>>
--
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/d/optout.