Why not just:
def index():
news = db(db.news.public == True).select(orderby=~db.news.added_on,limitby
=(0,10))
articles = db(db.articles.public == True).select(orderby=~db.articles.
added_on, limitby=(0,10))
return dict(news=news, articles=articles)
{{for row in news:}}
{{=H4(A(row['title_'+lang], _href=URL('default', 'article', args=row.id
)))}}
{{pass}}
{{for row in articles:}}
{{=H4(A(row['title_'+lang], _href=URL('default', 'news_content', args=row.
id)))}}
{{pass}}
Anthony
On Wednesday, May 23, 2012 7:38:50 PM UTC-4, CtrlSoft wrote:
>
> hi, i have this controller:
> def index():
>
> rows1 = db(db.news.public == True).select(orderby=~db.news.added_on,
> limitby=(0,10))
> rows2 = db(db.articles.public ==
> True).select(orderby=~db.articles.added_on, limitby=(0,10))
> rows = rows1.as_list()+rows2.as_list()
> return dict(rows=rows)
>
> the view:
> in view i need to know table name to generate url
>
> {{if rows:}}
> {{for row in rows:}}
> #if row.table_name == aritlces
>
> {{=H4(A(row['title_'+lang], _href=URL('default', 'article',
> args=row['id'])))}}
>
> #else
> {{=H4(A(row['title_'+lang], _href=URL('default', 'news_content',
> args=row['id'])))}}
>
>
> {{pass}}
> {{pass}}
>
>
> article and news functions:
> def article():
> return dict(row=db.articles[request.args(0)])
>
> def news_content():
> return dict(row=db.news[request.args(0)])
>
> any sugestions?
>
>