开发者

Django Forms replacement for Google App Engine (Python)

开发者 https://www.devze.com 2023-03-14 05:57 出处:网络
I am looking f开发者_高级运维or a Django Forms replacement. I need auto-build form based on GAE Model as in Django.

I am looking f开发者_高级运维or a Django Forms replacement.

I need auto-build form based on GAE Model as in Django. Django Forms work with some bugs on GAE. And I need to replace it.

I have found WTForms. What is your choice?


WTForms is a good choice on GAE. It is similar to django forms.

Also note, other than the ModelForms and the related types, django-forms should work quite well on the GAE, out of the box. In fact, that is one of the reason why django is even supported on GAE, in the first place.


I have looked for an answer to this as well.. And the only thing i can find is WTForms. WTForms comes with some integration towards translating models into forms. To be more specific, it has something called model_form found in wtforms.appengine.ext.model_form. With this you can make a form wit

form_obj = model_form(ModelClass)

#validate with
form = form_obj(request.POST)
if form.validate()
    mc = ModelClass
    form.populate_obj(mc)
    mc.put()

It doesnt support the new ndb-module jet. But most stuff works with small code-changes.. Hope it helps.

0

精彩评论

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