P
P
pcdesign2016-01-07 15:35:28
ORM
pcdesign, 2016-01-07 15:35:28

How to fill default values ​​in wtf?

I made a request to the database through Flask-sqlalchemy:
n = DraftCur.query.filter_by(dc_id=dc_id)
And I got a number of fields.
There is a form
form = DraftCurForm()
I can prescribe default values ​​like this:

form.dc_amount.default = 100500                                               
form.process()

But I can't figure out how to do it in a loop.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JRazor, 2016-01-07
@pcdesign

stackoverflow.com/questions/6196622/using-wtforms-...
Actually, make fields of the same name in the model and form, and load the data. Then to the form:
form = DraftCurForm(obj=ваши данные)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question