How do I remove the "Home" button in Python's Flask-Admin library?
from flask_admin import Admin
flask_admin = Admin(app,
name='Customer Admin',
template_mode='bootstrap3',
# endpoint refers to the blueprint [e.g. url_for('admin_cust.index')] where index() is the function/view
index_view=SecuredAdminIndexView(url='/admin_cust', endpoint='admin_cust')
)
# Add model (database table) views to the page
flask_admin_cust.add_view(UserView(User, db.session, category='Users', name='View/Edit User', endpoint='users'))
flask_admin.add_view(CustSubGroupView(CustSubGroup, db.session, name='Groups', endpoint='groups'))
flask_admin.add_view(GwView(Gw, db.session, endpoint='units', name='Units'))
Flask-Admin BaseView
has a method is_visible(self)
, the source code has a note:
Please note that item should be both visible and accessible to be displayed in menu.
For example, an index view could be along the following lines:
from flask_admin import Admin
from flask_admin import AdminIndexView
from flask_admin import expose, AdminIndexView
class DashboardView(AdminIndexView):
def is_visible(self):
# This view won't appear in the menu structure
return False
@expose('/')
def index(self):
return self.render(
'admin/dashboard.html',
)
flask_admin = Admin(app,
name='Customer Admin',
template_mode='bootstrap3',
index_view=DashboardView()
)