如何引用集合模板中的自定义字段

时间:2014-11-23 00:10:39

标签: plone dexterity

我正在尝试创建自定义收藏模板,其中包含一些自定义字段。

这就是我现在所拥有的:https://gist.github.com/adrigen/06bdc88bda6e9cf20a44

但错误是:NameError:name' resource_type'没有定义。

我知道我需要定义该变量,但我找不到合适的位置。 我试过了 <metal:block use-macro="context/standard_view/macros/entries" tal:define=" resource_type context/resource_type; >

还有其他一些地方,但它似乎没有什么区别。我错误地理解了什么?

1 个答案:

答案 0 :(得分:0)

根据Mathias&#39;我将定义移至<div class="icon" tal:define="...">。建议。

然后得到了错误

Expression: <PathExpr standard:u'context/resource_type'>
Names:

{'container': <PloneSite at /hccrems>,
 'context': <Collection at /hccrems/our-products/our-products/hccrems-purchasable-products/products>,
 'default': <object object at 0xb72c66a8>,
 'here': <Collection at /hccrems/our-products/our-products/hccrems-purchasable-products/products>,
 'loop': {u'item': <Products.PageTemplates.Expressions.PathIterator object at 0xb3dacf6c>},

注意到&#39; context&#39; item是一个对象时指的是集合,因此我将其更改为tal:define=" resource_type item/resource_type;

现在它很好。

相关问题