Admin 对象

class admin.Admin(app, url_prefix='/admin', title='flask-dashed', main_dashboard=None, endpoint='admin')

Class that provides a way to add admin interface to Flask applications.

Parameters:

  • app – The Flask application
  • url_prefix – The url prefix
  • main_dashboard – The main dashboard object
  • endpoint – The endpoint

add_path_security(path, function, http_code=403)

Registers security function for given path.

Parameters:

  • path – The endpoint to secure
  • function – The security function
  • http_code – The response http code

check_path_security(path)

Checks security for specific and path.

Parameters: path – The path to check

register_module(module_class, url_prefix, endpoint, short_title, title=None, parent=None)

Registers new module to current admin.

register_node(url_prefix, endpoint, short_title, title=None, parent=None, node_class=<class 'admin.AdminNode'>)

Registers admin node.

Parameters:

  • url_prefix – The url prefix
  • endpoint – The endpoint
  • short_title – The short title
  • title – The long title
  • parent – The parent node path
  • node_class – The class for node objects