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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.