[Flask] Help with Flask-WTF

Gergely Polonkai gergely at polonkai.eu
Sat May 6 13:50:05 EDT 2017


I think this might be a bug in Flask-Bootstrap; the quick_form macro fails
if there are no hidden fields in a form. Try adding a hidden field, like a
CSRF token (you do CSRF protection, don't you?)

Best,
Gergely

On Sat, May 6, 2017, 17:17 Lorenzo Mainardi <lormayna at gmail.com> wrote:

> Hello, I'm trying to do something with Flask-Bootstrap and Flask-WTF. This
> is my app.py:
>
> from flask import Flask
> from flask_wtf.csrf import CsrfProtect
> from flask_bootstrap import Bootstrap
>
> app = Flask(__name__)
> Bootstrap(app)
> CsrfProtect(app)
>
> This is my template:
>
> {% extends "bootstrap/base.html" %}
> {% import "bootstrap/wtf.html" as wtf %}
>
> {% block title %}
>
> {% endblock %}
>
> {% block content %}
> {{ wtf.quick_form(form) }}
> {% include "footer.html" %}
> {% endblock %}
>
> This is the traceback (only last line):
>
>   File "/home/lorenzo/projects/broen/lib/python2.7/site-packages/flask_bootstrap/templates/bootstrap/wtf.html", line 200, in template
>     {{ form.hidden_tag() }}
> UndefinedError: 'forms.SignupForm object' has no attribute 'hidden_tag'
>
> All packages are installed via pip. Could you help me to solve it? Regards
>
> --
> LORENZO MAINARDI
> http://blog.mainardi.me
> _______________________________________________
> Flask mailing list
> Flask at python.org
> https://mail.python.org/mailman/listinfo/flask
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20170506/06fb8bde/attachment.html>


More information about the Flask mailing list