我使用的是https://pypi.python.org/pypi/tgapp-resetpassword/0.1.5,它允许您覆盖用于重置密码页的模板。不幸的是,实际表单本身包含为“黑匣子”:
<div>
${reset_password_form.display(action=action)}
</div>表单被定义为tw2.forms.TableForm,这不是我想要显示它的方式。是否有可能有更精细的谷物控制,例如在每个字段周围插入自定义html,或者更明确地说明如何显示某些字段?
我想做的事情如下(组成):
<div>
<form ${reset_password_form.attrs} class="my-own-class-name">
<py:for each="field in reset_password_form.fields">
<div class="custom-class-here">
<label for="${field.id}">
... some logic to possibly override default label else...
${field.default_label_text}
</label>
${field.render_as_input_field()}
</div>
</py:for>
<button type="submit">My own submit text</button>
<form>
</div>在不覆盖Python的情况下,使用ToscaWidgets可以实现这种级别的自定义吗?
发布于 2015-04-24 16:43:15
通过重新设置密码文档,您可以使用一个reset_password.reset_password_form选项来指定替代的tw2表单。
您只需要将要使用的表单的python (如"resetpassword.lib.forms.ResetPasswordForm")放在那里,以代替默认表单。
然后,您自己的表单可以指定像https://gist.github.com/amol-/d2a08027d34a8c4dfa69这样的自定义模板。
https://stackoverflow.com/questions/29846715
复制相似问题