【发布时间】:2014-02-05 13:21:45
【问题描述】:
我在控制器中有这样的查询(很多列都被注释掉了)
rows=db( (c.email_sent == 0 ) & (c.status=='pending') ).select(db.f.first_name #.with_alias('requester_name') ,
# db.t.first_name.with_alias('receiver_name'),db.t.email.with_alias('sendto_email'),
# db.c.from_id.with_alias('sender_id'),db.c.to_id.with_alias('receiver_id'),
# db.c.id.with_alias('connection_id')
,join =
[db.f.on (db.f.id==c.from_id),
db.t.on(db.t.id==c.to_id)]
)
视图有
{{extend 'layout.html'}}
<table class="table">
{{for row in rows:}}
<tr>
<td>={{row.first_name}</td>
</tr>
</table>
而且效果很好。但是,如果我从控制器中删除注释掉的别名,我就无法让视图工作。我收到一个错误 - “(Rows 对象中有问题)”
函数参数列表为 (self=, sqlrows=, linkto=None, upload=None, orderby=None, headers={}, truncate=16, columns=['f.first_name AS requester_name', 't.first_name AS receiver_name ', 't.email AS sendto_email', 'c.from_id AS sender_id', 'c.to_id AS receiver_id', 'c.id AS connection_id'], th_link='', extracolumns=None, selectid=None, renderstyle=假,cid=无,colgroup=假,**属性={})
显然,列名没有正确传递。这应该怎么做?
【问题讨论】: