我们有对象,比如说xyz,它的视图是xyz_view,它的灵活性期望页面模板文件。有没有办法将默认页面类型覆盖到控制器页面模板?
所以视图应该是xyz_view.cpt而不是xyz_view.pt?
致以敬意,
发布于 2012-03-07 14:29:55
对于dexterity表单,没有使用控制器页面模板的实际场景。我也想不出比使用z3c.form更容易的场景。
发布于 2012-03-07 19:29:00
在视图模板中包含一个提交给自身的表单,并使用'update()‘方法处理请求并在某些条件下重定向:
class View(grok.View):
grok.context(IMyType)
grok.requires('zope2.View')
def update():
if 'form.button.Submit' in self.request:
input_value = self.request.get('input_value', None)
if input_value is not None:
self.request.response.redirect(self.context.absolute_url() + "@@process-this")有关更多信息,请参阅the five.grok manual instructions about simple views
https://stackoverflow.com/questions/9588673
复制相似问题