对不起,如果标题不清楚,想不到一个好的方式来制定它。 目前我检查,如果它没有父视图则显示它 我想这个改变控制器(显然)数据库有两种不同的表格要求
我的表:
db.define_table('comments',
Field('parent_id', 'reference comments', readable=False, writable=False),
Field('body', 'text', label='Message', requires=IS_NOT_EMPTY()),
auth.signature)
db.define_table('comments_users',
Field('user_id', 'reference auth_user', requires=IS_NOT_EMPTY()),
Field('comments_id', 'reference comments', requires=IS_NOT_EMPTY()),
Field('permission', 'integer', requires=IS_NOT_EMPTY()))
的选择我想那并不是”将不起作用:
rows = db(
(db.comments_users.user_id==auth.user.id) &
(db.comments_users.comments_id.parent_id==0) # something like this is possible in view with a single row
).select(limitby=(0, 10))
我现在做中,我想改变控制器
{{for row in rows:}}
{{if row.comments_id.parent_id==0:}}
<td>{{=row.comments_id}}</td>
{{pass}}
{{pass}}
视图
非常感谢你 我在尝试加入之前遇到的问题是我忘记了(db.comments.id == db.comments_users.comments_id)),这只是我身边的愚蠢。 – PrivateerGerrit 2014-10-20 17:33:33