【发布时间】:2018-11-29 08:17:30
【问题描述】:
我在 Yesod 应用程序中定义了以下模型:
CvCategory
title Text
order Int
UniqueCvCategory title
CvItem
category CvCategoryId
title Text
fromYear Int
toYear Int Maybe
description Text Maybe
UniqueCvItem title
我在处理程序中有以下查询:
cvcategories <- selectList [] [] --all cv categories
在我的小村庄模板中,我想做类似的事情:
<ul>
$forall cvcategory <- cvcategories
<li>$#{cvCategoryTitle cvcategory}
$forall cvitem <- cvcategory --how?
<li>#{cvItemTitle cvitem}
在 Django 中,您可以轻松定义 related_name,然后使用它轻松访问所有“子对象”。 Yesod也有可能吗?怎么样?
【问题讨论】:
标签: sql haskell yesod persistent hamlet