Re: [web2py] only last item on the dict is rendered.
I created a dict instead of a list and I'm getting there...thanks. On Saturday, December 28, 2013 12:44:09 AM UTC+2, Jonathan Lundell wrote: > > On 27 Dec 2013, at 2:42 PM, Avi A > wrote: > > member.auth_user.email throws the same error. > auth_user.email is defined in the select on the controller, as far as i > understand, > among other fields from the auth user table.. > > > It's not. > > Try member.email. If that doesn't work, just display member and see what's > in it. > > > On Saturday, December 28, 2013 12:35:54 AM UTC+2, Jonathan Lundell wrote: >> >> On 27 Dec 2013, at 2:20 PM, Avi A wrote: >> >> 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:}} >> {{=member[auth_user.email]}} >> {{pass}} >> >> >> You want something like member.auth_user.email or maybe member.email. >> auth_user isn't a variable defined in your controller or view; it's an >> element of the row. >> >> >> >> 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 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 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 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:}} >> {{=member}} >> {{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:}} >> {{=member}} >> {{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
Re: [web2py] only last item on the dict is rendered.
yes i tried that one too. {{=member}} renders inside each option atable with expected data: auth_user.phone_numauth_user.car_num_0 auth_user.emailauth_user.profile_image auth_user.first_nameauth_user.last_name0548102940111aviavia4u+1@g... fileAviAbramovitch On Saturday, December 28, 2013 12:35:54 AM UTC+2, Jonathan Lundell wrote: > > On 27 Dec 2013, at 2:20 PM, Avi A > wrote: > > 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:}} > {{=member[auth_user.email]}} > {{pass}} > > > You want something like member.auth_user.email or maybe member.email. > auth_user isn't a variable defined in your controller or view; it's an > element of the row. > > > > 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 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 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 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:}} > {{=member}} > {{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:}} > {{=member}} > {{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) > > > > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https
Re: [web2py] only last item on the dict is rendered.
On 27 Dec 2013, at 2:42 PM, Avi A wrote: > member.auth_user.email throws the same error. > auth_user.email is defined in the select on the controller, as far as i > understand, among other fields from the auth user table.. It's not. Try member.email. If that doesn't work, just display member and see what's in it. > > On Saturday, December 28, 2013 12:35:54 AM UTC+2, Jonathan Lundell wrote: > On 27 Dec 2013, at 2:20 PM, Avi A wrote: >> 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:}} >> {{=member[auth_user.email]}} >> {{pass}} > > You want something like member.auth_user.email or maybe member.email. > auth_user isn't a variable defined in your controller or view; it's an > element of the row. > >> >> >> 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 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 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 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:}} > {{=member}} > {{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:}} {{=member}} {{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) > > > > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.go
Re: [web2py] only last item on the dict is rendered.
member.auth_user.email throws the same error. auth_user.email is defined in the select on the controller, as far as i understand, among other fields from the auth user table.. On Saturday, December 28, 2013 12:35:54 AM UTC+2, Jonathan Lundell wrote: > > On 27 Dec 2013, at 2:20 PM, Avi A > wrote: > > 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:}} > {{=member[auth_user.email]}} > {{pass}} > > > You want something like member.auth_user.email or maybe member.email. > auth_user isn't a variable defined in your controller or view; it's an > element of the row. > > > > 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 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 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 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:}} > {{=member}} > {{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:}} > {{=member}} > {{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) > > > > > -- 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 mess
Re: [web2py] only last item on the dict is rendered.
On 27 Dec 2013, at 2:20 PM, Avi A wrote: > 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:}} > {{=member[auth_user.email]}} > {{pass}} You want something like member.auth_user.email or maybe member.email. auth_user isn't a variable defined in your controller or view; it's an element of the row. > > > 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 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 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 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:}} {{=member}} {{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:}} >>> {{=member}} >>> {{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) -- 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/groups/opt_out.
Re: [web2py] only last item on the dict is rendered.
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:}} {{=member[auth_user.email]}} {{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 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 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 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:}} {{=member}} {{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:}} {{=member}} {{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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] only last item on the dict is rendered.
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 > > 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 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 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:}} >>> {{=member}} >>> {{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:}} >>> {{=member}} >>> {{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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] only last item on the dict is rendered.
On 27 Dec 2013, at 10:53 AM, Avi A 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 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 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:}} >>> {{=member}} >>> {{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:}} >> {{=member}} >> {{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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] only last item on the dict is rendered.
for case my_org is empty i wrote: if my_org: not good enough? (if not empty?) On Friday, December 27, 2013 8:37:55 PM UTC+2, Jonathan Lundell wrote: > > On 27 Dec 2013, at 10:23 AM, Avi A > > 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 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:}} >> {{=member}} >> {{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:}} >> {{=member}} >> {{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) --- 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/groups/opt_out.
Re: [web2py] only last item on the dict is rendered.
Alright, I see what you mean. I'll give it a try. Thanks. On Friday, December 27, 2013 8:37:55 PM UTC+2, Jonathan Lundell wrote: > > On 27 Dec 2013, at 10:23 AM, Avi A > > 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 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:}} >> {{=member}} >> {{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:}} >> {{=member}} >> {{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) --- 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/groups/opt_out.
Re: [web2py] only last item on the dict is rendered.
On 27 Dec 2013, at 10:23 AM, Avi A 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 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:}} >> {{=member}} >> {{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:}} > {{=member}} > {{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) --- 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/groups/opt_out.
Re: [web2py] only last item on the dict is rendered.
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. On Friday, December 27, 2013 8:12:15 PM UTC+2, Jonathan Lundell wrote: > > On 27 Dec 2013, at 9:53 AM, Avi A > 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:}} > {{=member}} > {{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:}} > {{=member}} > {{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) --- 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/groups/opt_out.
Re: [web2py] only last item on the dict is rendered.
On 27 Dec 2013, at 9:53 AM, Avi A 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:}} > {{=member}} > {{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:}} {{=member}} {{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) --- 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/groups/opt_out.