开发者

Formbuild with Pylons?

Is using formbuild with pylons, when you have pretty customized needs, actually easier tha开发者_StackOverflow中文版n manually creating your own form html?


I really prefer plain html, but it's super easy populate a select with a syntax like this:

def foo(self):
    c.countries = Model.get(Country)....
return Render('foo.html')

Template:

${h.field(
    "Country:",
    h.select(
    "country",
    id='country',
    options = c.countries,
    selected_values=[],
    required=True,
 ),
)}

also custom validation it's handled pretty well along with FormEncode


That would be bad if you use many forms of

I suggest using Pylons with WTForm

To cope with WTForm create a separate class, for example, a Layout that will handle all of the fields in the form of a uniform standard adopted by your site.

This is very good to make the processing of forms in a separate class because they do not have to redo all the forms will only need to change the layout of the base class

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜