Skip to content Skip to sidebar Skip to footer

WTForms-JSON Not Receiving Form Data

WTForms-JSON docs here. This has been a bug from hell I cannot wrap my head around. I have a simple API handler that works perfectly fine from Postman JSON POSTs. However when I pl

Solution 1:

This was caused by some old documentation floating around. WTForms has built in support for handling serialized JSON now, you don't need the from_json or the request.json anymore.

Simply import and instantiate your form as you would.

Fixed code as follows:

@app.route('/')
    def index():
    form = SubmitWorkorderForm.from_json()
    print form.data
    return render_template('submitworkorder.html', form = form)

Post a Comment for "WTForms-JSON Not Receiving Form Data"