diff --git a/app/__init__.py b/app/__init__.py index c02a6d8..463108c 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -5,6 +5,7 @@ from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager from werkzeug.exceptions import HTTPException from flask_migrate import Migrate +from flask_wtf import FlaskForm from app.logger import log @@ -60,6 +61,12 @@ def create_app(environment="development"): login_manager.login_message_category = "info" login_manager.anonymous_user = AnonymousUser + # Jinja globals + + # Using: {{ flask_form.hidden_tag() }} + with app.app_context(): + app.jinja_env.globals["flask_form"] = FlaskForm() + # Error handlers. @app.errorhandler(HTTPException) def handle_http_error(exc): diff --git a/app/templates/book/add_book_modal.html b/app/templates/book/add_book_modal.html index 68e2b71..1dfb3aa 100644 --- a/app/templates/book/add_book_modal.html +++ b/app/templates/book/add_book_modal.html @@ -4,7 +4,7 @@