You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iTi-Flask/copier-template/{{ project_slug }}/modules/example/module.py.jinja

36 lines
1.1 KiB
Django/Jinja

from .routes import bp
from iti.applications.common.enums import MenuTypeEnum
from iti.modules import ModuleMenuSeed, ModulePermission, get_module_registry
class ExampleModule:
name = "example"
def register_routes(self, app):
app.register_blueprint(bp, url_prefix="/example")
def register_permissions(self, app):
registry = get_module_registry(app)
registry.register_permission(
ModulePermission(
code="example:item:list",
name="示例列表",
description="查看示例模块数据",
)
)
def register_menu_seed(self, app):
registry = get_module_registry(app)
registry.register_menu_seed(
ModuleMenuSeed(
id="example-menu-root",
name="Example",
type=MenuTypeEnum.MENU.value,
path="/example",
component="/example/list",
auth_code="example:item:list",
meta={"title": "示例模块", "icon": "carbon:application"},
sort=100,
)
)