db.static_text.id is a field object. If you want a record, you would do:
db.static_text(1)
or
db(db.static_text.id == 1).select().first()
Anthony
On Thursday, October 3, 2013 10:09:54 AM UTC-4, Gael Princivalle wrote:
>
> Hi.
>
> I want to show different fields in my applications, depending of the
> current language (italian or english).
>
> Here is my table with static text like company presentation...
>
> db.define_table('static_text',
> Field('title_en'),
> Field('title_it'),
> Field('text_en', type='text'),
> Field('text_it', type='text'))
>
> The controller: (I know that company's texts are in the row with id==1
> def company():
> company = db.static_text.id[1]
> return dict(company=company)
>
> The view:
> {{extend 'layout.html'}}
> <h1>Company page</h1>
> {{if T.accepted_language=='it':}}
> {{=p(company.title_it)}}
> {{=p(company.text_it)}}
> {{else:}}
> {{=p(company.title_en)}}
> {{=p(company.text_en)}}
> {{pass}}
>
> I have this error: Expression' object has no attribute 'title_it'.
>
> Someone can give me a hand ?
>
--
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.