def _add_view_to_menu(self, view): """ Add a view to the menu tree :param view: View to add """ self.add_menu_item(MenuView(view.name, view), view.category)
def _set_admin_index_view(self, index_view=None, endpoint=None, url=None): """ Add the admin index view. :param index_view: Home page view to use. Defaults to `AdminIndexView`. :param url: Base URL :param endpoint: Base endpoint name for index view. If you use multiple instances of the `Admin` class with a single Flask application, you have to set a unique endpoint name for each instance. """ self.index_view = index_view or AdminIndexView(endpoint=endpoint, url=url) self.endpoint = endpoint or self.index_view.endpoint self.url = url or self.index_view.url # Add predefined index view # assume index view is always the first element of views. if len(self._views) > 0: self._views[0] = self.index_view self._menu[0] = MenuView(self.index_view.name, self.index_view) else: self.add_view(self.index_view)
def _add_view_to_menu(self, view): self._add_menu_item(MenuView(view.name, view), view.category)
def _add_view_to_menu(self, view): menu_view = MenuView(view.name, view, cache=False) self.add_menu_item(menu_view, view.category)