現在のテーブルの各行に対して別のテーブルからフィールドを取得する必要があるため、web2py のビューからデータベース テーブルをクエリしようとしているので、次のようなコードを記述しました。
{{for recipe in rows:}}
<div class="well">
<table>
<tr>
<td>
<div style="text-align:center">
<img width="200px"
src="{{=URL('download', args=db(db.uploads.recipe_id==recipe.id).select().first().up_file)}}" />
</div>
</td>
<td><button>
-
</button></td><td><span class='votes'>{{=recipe.votes}}</span></td><td><button>
+
</button><td><strong>{{=A("comments",_href=URL('view_posts',args=recipe.id))}},{{=recipe.name}}</strong></td></td></tr>
</table>
</div>
{{pass}}
しかし、ビューからデータベースにクエリを実行できるかどうかは疑問です。そうでない場合、どうすればコントローラーから同じものを照会してビューに返すことができますか? これはばかげた疑問かもしれませんが、申し訳ありませんが、私は web2py を初めて使用します