I'm tring to create an app with flask with WTForms.
In the controller.py i have:
@mod_private.route('/portfolio/', methods=['GET', 'POST'])
@login_required
def portfolio():
print "in portfolio" # I read this
form = CreateCoinsForm(request.form)
if request.method == 'POST' and form.validate_on_submit():
print form.coins.data #I cannot take this value
return render_template("private/portfolio.html",form=form)
return render_template("private/portfolio.html",form=form)
in the forms.py:
class CreateCoinsForm(Form):
coins = IntegerField('coins',
[DataRequired('num required'),
NumberRange(min=0, max=10)])
and the template
<form method="post" action="/private/portfolio/" accept-charset="UTF-8" role="form">
<p> {{ form.coins }}</p>
<p><input type=submit value=Generate>
</form>
my problem, as i wrote in the code is that I cannot retrieve the string inserted in the template.