mirror of
https://github.com/fastapi-admin/fastapi-admin.git
synced 2025-08-15 11:11:19 +08:00
fix cli error
This commit is contained in:
@ -4,6 +4,10 @@ ChangeLog
|
||||
|
||||
0.2
|
||||
===
|
||||
0.2.6
|
||||
-----
|
||||
- Fix createsuperuser error.
|
||||
|
||||
0.2.5
|
||||
-----
|
||||
- Now there has builtin menus.
|
||||
|
@ -28,8 +28,10 @@ class Logger:
|
||||
|
||||
|
||||
def import_obj(path):
|
||||
module_name, class_name = path.rsplit('.', 1)
|
||||
return getattr(importlib.import_module(module_name), class_name)
|
||||
splits = path.split(".")
|
||||
module = ".".join(splits[:-1])
|
||||
class_name = splits[-1]
|
||||
return getattr(importlib.import_module(module), class_name)
|
||||
|
||||
|
||||
async def init_tortoise(args):
|
||||
@ -63,7 +65,7 @@ async def register_permissions(args):
|
||||
async def createsuperuser(args):
|
||||
await init_tortoise(args)
|
||||
|
||||
user_model = import_obj(args.user_model)
|
||||
user_model = Tortoise.apps.get('models').get(args.user_model)
|
||||
prompt = PromptSession()
|
||||
while True:
|
||||
try:
|
||||
@ -104,6 +106,6 @@ def cli():
|
||||
run_async(parse_args.func(parse_args))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def main():
|
||||
sys.path.insert(0, ".")
|
||||
cli()
|
||||
|
@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "fastapi-admin"
|
||||
version = "0.1.0"
|
||||
version = "0.2.6"
|
||||
description = "Fast Admin Dashboard based on fastapi and tortoise-orm and rest-admin."
|
||||
authors = ["long2ice <long2ice@prismslight.com>"]
|
||||
|
||||
|
Reference in New Issue
Block a user