Framework Managers¶
One design goal of the base grid class is that it be essentially framework-agnostic. That is, the grid, by itself, should not care if it is being run in Flask, BlazeWeb, or another web app framework. As long as it has a connection to the framework that provides required items with a consistent interface, the grid should interact with the framework through that connection.
Wrapped features available through the manager:
SQLAlchemy connection and queries
Request
Session storage
Flash messages
File export in response
-
class
webgrid.flask.
WebGrid
(db=None)[source]¶ Grid manager for connecting grids to Flask webapps.
Instance should be assigned to the manager attribute of a grid class:
class MyGrid(BaseGrid): manager = WebGrid()
- Args:
db (flask_sqlalchemy.SQLAlchemy, optional): Database instance. Defaults to None. If db is not supplied here, it can be set via init_db later.
- Class Attributes:
jinja_loader (jinja.Loader): Template loader to use for HTML rendering.
args_loaders (ArgsLoader[]): Iterable of classes to use for loading grid args, in order of priority
session_max_hours (int): Hours to hold a given grid session in storage. Set to None to disable. Default 12.