diff --git a/src/ohmyapi/cli.py b/src/ohmyapi/cli.py index a530424..fd41084 100644 --- a/src/ohmyapi/cli.py +++ b/src/ohmyapi/cli.py @@ -165,6 +165,13 @@ def createsuperuser(root: str = "."): ) user.set_email(email) user.set_password(password1) - asyncio.run(project.init_orm()) - asyncio.run(user.save()) - asyncio.run(project.close_orm()) + + async def _run(): + await project.init_orm() + user = ohmyapi_auth.models.User(username=username, is_staff=True, is_admin=True) + user.set_email(email) + user.set_password(password1) + await user.save() + await project.close_orm() + + asyncio.run(_run())