8.2.10.4.1.1. Admin

class Admin(app, name='Admin', index_view=None, url=None, endpoint=None, **kwargs)[source]

Methods

__delattr__

Implement delattr(self, name).

__dir__

Default dir() implementation.

__eq__

Return self==value.

__format__

Default object formatter.

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__getstate__

Helper for pickle.

__gt__

Return self>value.

__hash__

Return hash(self).

__init__

Constructor.

__init_subclass__

This method is called when a class is subclassed.

__le__

Return self<=value.

__lt__

Return self<value.

__ne__

Return self!=value.

__new__

__reduce__

Helper for pickle.

__reduce_ex__

Helper for pickle.

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__

Size of object in memory, in bytes.

__str__

Return str(self).

__subclasshook__

Abstract classes can override this to customize issubclass().

_add_menu_item

_add_view_to_menu

Add a view to the menu tree

_init_extension

_set_admin_index_view

Add the admin index view.

_validate_admin_host_and_subdomain

add_category

Add a category of a given name

add_link

Add link to menu links collection.

add_links

Add one or more links to the menu links collection.

add_menu_item

Add menu item to menu tree hierarchy.

add_model

add_sub_category

Add a category of a given name underneath the category with parent_name.

add_view

Add a view to the collection.

add_views

Add one or more views to the collection.

get_category_menu_item

init_app

Register all views with the Flask application.

menu

Return the menu hierarchy.

menu_links

Return menu links.

__init__(app, name='Admin', index_view=None, url=None, endpoint=None, **kwargs)[source]

Constructor.

Parameters:
  • app – Flask application object

  • name – Application name. Will be displayed in the main menu and as a page title. Defaults to “Admin”

  • url – Base URL

  • subdomain – Subdomain to use

  • index_view – Home page view to use. Defaults to AdminIndexView.

  • translations_path – Location of the translation message catalogs. By default will use the translations shipped with Flask-Admin.

  • 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.

  • static_url_path – Static URL Path. If provided, this specifies the default path to the static url directory for all its views. Can be overridden in view configuration.

  • theme – Base theme. Defaults to Bootstrap4Theme().

  • category_icon_classes – A dict of category names as keys and html classes as values to be added to menu category icons. Example: {‘Favorites’: ‘glyphicon glyphicon-star’}

  • host – The host to register all admin views on. Mutually exclusive with subdomain

  • csp_nonce_generator – A callable that returns a nonce to inject into Flask-Admin JS, CSS, etc.

Attributes

__annotations__

__dict__

__doc__

__module__

__weakref__

list of weak references to the object

__init__(app, name='Admin', index_view=None, url=None, endpoint=None, **kwargs)[source]

Constructor.

Parameters:
  • app – Flask application object

  • name – Application name. Will be displayed in the main menu and as a page title. Defaults to “Admin”

  • url – Base URL

  • subdomain – Subdomain to use

  • index_view – Home page view to use. Defaults to AdminIndexView.

  • translations_path – Location of the translation message catalogs. By default will use the translations shipped with Flask-Admin.

  • 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.

  • static_url_path – Static URL Path. If provided, this specifies the default path to the static url directory for all its views. Can be overridden in view configuration.

  • theme – Base theme. Defaults to Bootstrap4Theme().

  • category_icon_classes – A dict of category names as keys and html classes as values to be added to menu category icons. Example: {‘Favorites’: ‘glyphicon glyphicon-star’}

  • host – The host to register all admin views on. Mutually exclusive with subdomain

  • csp_nonce_generator – A callable that returns a nonce to inject into Flask-Admin JS, CSS, etc.

init_app(app, **kwargs)[source]

Register all views with the Flask application.

add_model(model, **kwargs)[source]
__annotations__ = {'_menu_categories': 'dict[str, MenuCategory]', 'theme': 'Theme'}
__doc__ = None
__module__ = 'schedula.utils.form.server.admin'
_menu_categories: dict[str, MenuCategory]
theme: Theme