Now I am able to get the list as you suggested with append.
But i don't know how to render it.
This is what I try in the view but it says that NameError: name 'auth_user' is
not defined:
{{for member in org_member_data:}}
<option>{{=member[auth_user.email]}}</option>
{{pass}}
On Friday, December 27, 2013 9:14:55 PM UTC+2, Avi A wrote:
>
> user logged in
> the view:
> if he is in a group:
> till now he will see the group members' data and take some action later on.
> else:
> will sign up for a group.
> after page refresh will see the group members' data.
>
> (will have a different page for modifying subscription.)
>
>
> On Friday, December 27, 2013 8:54:34 PM UTC+2, Jonathan Lundell wrote:
>>
>> On 27 Dec 2013, at 10:53 AM, Avi A <[email protected]> wrote:
>>
>> for case my_org is empty i wrote:
>> if my_org:
>> not good enough? (if not empty?)
>>
>>
>> If that happens, what does the view see?
>>
>>
>>
>> On Friday, December 27, 2013 8:37:55 PM UTC+2, Jonathan Lundell wrote:
>>>
>>> On 27 Dec 2013, at 10:23 AM, Avi A <[email protected]> wrote:
>>>
>>> Thanks,
>>> I wasn't wrong, this is what I need:
>>>
>>> {{for member in org_member_data:}}
>>>
>>> what do you mean by:
>>> "org_member_data is set to a single member's data, so it ends up with
>>> the last one it was set to. ?
>>> or:
>>> or perhaps collect org_member_data instances in a list?
>>>
>>> i return it as a dict or as locals() and it still renders the last one
>>> only.
>>>
>>>
>>> You assign org_member_data to the select of a single row at a time.
>>> Assigning it three times doesn't mean that it'll contain all three rows.
>>>
>>> Another potential problem is that org_member_data is undefined if my_org
>>> is empty; it'd be prudent to initialize it to None (and check for that).
>>>
>>> But I think what you really mean is something like:
>>>
>>> org_member_data = []
>>> ...
>>> for member in my_org_members:
>>> org_member_data.append(db(db.auth_user.id ==
>>> member.created_by).select(db.auth_user.phone_num, db.auth_user.car_num_0,
>>> db.auth_user.email,
>>> db.auth_user.profile_image,db.auth_user.first_name, db.auth_user.last_name
>>> ))
>>>
>>>
>>>
>>>
>>> On Friday, December 27, 2013 8:12:15 PM UTC+2, Jonathan Lundell wrote:
>>>>
>>>> On 27 Dec 2013, at 9:53 AM, Avi A <[email protected]> wrote:
>>>>
>>>> Hi,
>>>> I'm doing something like that:
>>>> if auth.user:
>>>> my_org = db(db.t_org_members.f_org_member == auth.user.id
>>>> ).select(db.t_org_members.f_org_rep)
>>>> if my_org:
>>>> for m in my_org:
>>>> my_org_members = db(db.t_org_members.f_org_rep ==
>>>> m.f_org_rep).select(db.t_org_members.created_by)
>>>> for member in my_org_members:
>>>> org_member_data = db(db.auth_user.id ==
>>>> member.created_by).select(db.auth_user.phone_num, db.auth_user.car_num_0,
>>>> db.auth_user.email,
>>>> db.auth_user.profile_image,db.auth_user.first_name, db.auth_user.last_name
>>>> )
>>>>
>>>> The only problem is that :
>>>>
>>>> while this renders three members as expected:
>>>> {{=my_org_members}}
>>>>
>>>> This renders the last member's data only:
>>>>
>>>> {{for member in org_member_data:}}
>>>> <option value="car_">{{=member}}</option>
>>>> {{pass}}
>>>>
>>>>
>>>> Thanks.
>>>>
>>>>
>>>> org_member_data is set to a single member's data, so it ends up with
>>>> the last one it was set to.
>>>>
>>>> Did you mean to write:
>>>>
>>>> {{for member in my_org_members:}}
>>>> <option value="car_">{{=member}}</option>
>>>> {{pass}}
>>>>
>>>> ... or perhaps collect org_member_data instances in a list?
>>>>
>>>
>>>
>>>
>>>
>>>
>> --
>> 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)
>>
>>
>>
>>
>>
--
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/groups/opt_out.