Checking uniqueness contraint during form validation in App Engine

ε祈祈猫儿з 提交于 2019-12-02 09:46:18

Edit: didn't answer your question properly the first time.

Separate instances of the Form object will be instantiated for the GET and POST requests, so you can't save the old_name to self.

You'll need to pass the old_name to the browser in the form, and have the browser submit the old_name back in the POST request.

The easyish way to do this is to create a hidden form field that the user doesn't see, but will get submitted by the POST request. I'm not too familiar with WTForms but I assume you can initialize the old_name field value in your the GET request handler.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!