I am new to python and flask and trying to understand "wtforms" but so far didn't find any tutorials that actually explains the complete functionality. Like in some places data is set in the "GET" request like

form.country = DBModel.country

some use it like

form.country.data = DBModel.country

other use it like

form.country.query = DBModel.country

The other thing I don't understand is "wtforms" functionality in "POST" request.

Where exactly data is extracted from the request?

I cannot see any data extraction from request in any example. They simply define the instance of "wtform" and starts adding the data to DB.

有帮助吗?

解决方案

If You are new in Python and Flask read this blog :) It contains series of articles how to start and develop the flask project. It can be very useful.

About problems with wtforms try to find something useful in flask snippets.

In wtforms.Form you have properties data - it is a dict containing the data for each field. If You want to fill form with data from model there is populate_obj() method.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top