You could always do something like:

{{for i in range(len(all_items)):}}
{{=A(all_items.render(i, fields=db.t_stores.owner_id).owner_id,
     _href=URL('default', 'stores', args=all_items[i].owner_id))}}
{{pass}}

Note, you don't have to specify the "fields" argument to .render(), but if 
you only need one field rendered, that will be more efficient, as it won't 
bother rendering the other fields.

Anthony

On Saturday, December 14, 2013 5:22:03 PM UTC-5, Avi A wrote:
>
> For example:
> <a href="myapp/default/stores/onwer_id">represnet(owner_id)</a>
>
> On Saturday, December 14, 2013 11:57:02 PM UTC+2, Avi A wrote:
>>
>> One more question please,
>> The thing is that I need both to be rendered, the represented and NOT 
>> represented value, so I can use it in the args() for example to the user 
>> profile or store link.?
>> I tried back with the represent()method but I still get the:
>>
>> NoneType' object is not callable
>>
>> So if there is a different way, please let me know.
>>
>> thanks.
>>
>>
>> On Saturday, December 14, 2013 11:00:53 PM UTC+2, Avi A wrote:
>>>
>>> allright, 2.8.2 is now working and all is rendered referenced as 
>>> expected using that:
>>> {{for item in all_items.render():}}
>>> {{=item.created_by}}
>>> {{=item.f_item_category}}
>>> {{=item.f_item_store}}
>>> {{pass}} 
>>> Thank you very much.
>>> On Saturday, December 14, 2013 10:28:50 PM UTC+2, Avi A wrote:
>>>>
>>>> during this chat I upgraded to 2.8.2 and now i am stuck with some erro 
>>>> about:
>>>>  maxnum = MAXNFILES)
>>>> in the admin/controller/default.
>>>> :(
>>>>
>>>>
>>>> On Saturday, December 14, 2013 10:24:40 PM UTC+2, Anthony wrote:
>>>>>
>>>>> Looks like there was a bug in the .render() code up until 2.7.2, so 
>>>>> you'll have to upgrade or edit dal.py to make it work. Even with the bug, 
>>>>> I 
>>>>> think you can instead do:
>>>>>
>>>>> {{for item in [all_items.render(i) for i in range(len(all_items))]:}}
>>>>> {{=item.created_by}}
>>>>> ...
>>>>>
>>>>> Anthony
>>>>>
>>>>> On Saturday, December 14, 2013 3:17:03 PM UTC-5, Anthony wrote:
>>>>>>
>>>>>> Can you show the whole traceback? I don't know why you'd be getting 
>>>>>> that error. Which version of web2py?
>>>>>>
>>>>>> On Saturday, December 14, 2013 2:53:11 PM UTC-5, Avi A wrote:
>>>>>>>
>>>>>>> I tried {{for item in all_items.render():}}
>>>>>>>
>>>>>>> On Saturday, December 14, 2013 9:48:57 PM UTC+2, Anthony wrote:
>>>>>>>>
>>>>>>>> Did you do all_items.render() or all_items.repr()?
>>>>>>>>
>>>>>>>> On Saturday, December 14, 2013 2:12:31 PM UTC-5, Avi A wrote:
>>>>>>>>>
>>>>>>>>> when i try the render() metohod I get:
>>>>>>>>>
>>>>>>>>> AttributeError: 'Rows' object has no attribute 'repr'
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> So I'm probably on a different versioon?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Saturday, December 14, 2013 8:02:08 PM UTC+2, Avi A wrote:
>>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>> I want to display item and use the represent() method to display 
>>>>>>>>>> reference fields.
>>>>>>>>>> def home():
>>>>>>>>>>     all_items = db(db.t_items).select()
>>>>>>>>>>     owner_rep = db.t_stores.created_by
>>>>>>>>>>     store_rep = db.t_stores.f_store_name
>>>>>>>>>>     category_rep = db.t_categories.f_category_name
>>>>>>>>>>     return dict(all_items = all_items, owner_rep = owner_rep, 
>>>>>>>>>> store_rep = store_rep, category_rep = category_rep)
>>>>>>>>>>
>>>>>>>>>> #On the view page :
>>>>>>>>>> {{for item in all_items:}}
>>>>>>>>>> {{=owner_rep.represent(item.created_by)}}
>>>>>>>>>> {{=category_rep.represent(item.f_item_category)}}
>>>>>>>>>> {{=store_rep.represent(item.f_item_store)}}
>>>>>>>>>> {{pass}}
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> While it works for the {{=owner_rep....... line, for any of the 
>>>>>>>>>> other line I try to do the same (those under it) I get the error:
>>>>>>>>>>
>>>>>>>>>> TypeError: 'NoneType' object is not callable.
>>>>>>>>>>
>>>>>>>>>> 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/groups/opt_out.

Reply via email to