I would use virtual fields to create the required fields based on the
client language.
I you have not yet, you could check the info in the web2py book: from
section 6.20.1

On the other hand I'd consider using the web2py internationalization
features to translate every input from english.

On 12 feb, 09:41, Td CtrlSoft <[email protected]> wrote:
> in model:
>
> db.define_table("news",
>     Field("title_en",requires=IS_NOT_EMPTY()),
>     Field("conten_en" ,type='text'),
>
>     Field("title_fr",requires=IS_NOT_EMPTY()),
>     Field("conten_fr" ,type='text'),
>
>     Field("title_de",requires=IS_NOT_EMPTY()),
>     Field("conten_de" ,type='text'),
>     #========
>     Field('added_on', 'datetime', default=request.now,
> requires=IS_DATETIME(format=T('%d-%m-%Y %H:%M:%S'))),
>     Field('updated_on', 'datetime', default=request.now,
> update=request.now, requires=IS_DATETIME(format=T('%d-%m-%Y %H:%M:%S'))))
>
> in controller:
>
>     if lang == 'de':
>         news = [db.news.title_de, db.news.conten_de]
>     elif lang == 'fr':
>         news = [db.news.title_fr, db.news.conten_fr]
>     else:
>         news = [db.news.title_en, db.news.conten_en]
>
>     rows = db(db.news).select(*news)
>    #
>     return dict(row=rows)
>
> in view:
> here i need a common row something like
> {{=row.title}}
> {{=row.content}}
>
> so how can i create a common row object for different filds names? thx

Reply via email to