[models] make it so tortoise runs inside textual's async loop thing
This commit is contained in:
parent
df845c41f3
commit
221062ead5
2 changed files with 7 additions and 1 deletions
|
|
@ -2,7 +2,7 @@
|
|||
This file exists so the directory becomes a package.
|
||||
"""
|
||||
|
||||
from .main import main
|
||||
from teilchensammler_cli.main import main
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ from textual.widgets import (
|
|||
Input,
|
||||
Static,
|
||||
)
|
||||
from tortoise import Tortoise, fields
|
||||
from tortoise.models import Model
|
||||
|
||||
|
||||
@final
|
||||
|
|
@ -98,6 +100,10 @@ class AddInventoryScreen(Screen[None]):
|
|||
@final
|
||||
class SammlerApp(App[None]):
|
||||
async def on_mount(self) -> None:
|
||||
await Tortoise.init(
|
||||
db_url="sqlite://db.sqlite3", modules={"models": ["teilchensammler_cli"]}
|
||||
)
|
||||
await Tortoise.generate_schemas()
|
||||
_ = self.push_screen(AddInventoryScreen())
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue