October 2018
Intermediate to advanced
332 pages
8h 9m
English
The BaseView class allows normal Flask pages to be added to your admin interface. This is normally the least used type of view in Flask Admin setups, but if you wish to include something like custom reporting with JavaScript charting libraries, you can do it with a base view alone. As expected, we are going to define our views in the admin/controllers.py file:
from flask.ext.admin import BaseView, expose
class CustomView(BaseView):
@expose('/') @login_required @has_role('admin')
def index(self):
return self.render('admin/custom.html')
@expose('/second_page') @login_required @has_role('admin')
def second_page(self):
return self.render('admin/second_page.html')
In a subclass of BaseView, multiple views can be registered ...