Skip to main content

Working with Custom Views

BaseView

To add custom views to the Admin interface where you want to access database and SQLAlchemy models, you can use the BaseView. Here’ an example
you can create report.html inside templates directory with the following content
If you want to use a custom templates directory name, you can change that with:
Now visiting /admin/report you can render your report.html file.

ModelView

You can also add extra endpoint in modelview with the help of expose decorator. The path is in this case prepended with the view’s identity. i.e /admin/user/profile/{pk}
In the above example, By adding detail method in column_list will display link that lead to custom view. Keep in the mind that, method must contain one argument, in our case is user object. user.html inside templates directory contains