📝 Add hints for model-to-schema conversion
This commit is contained in:
parent
67d4264f0d
commit
cb5bfdebe1
1 changed files with 6 additions and 5 deletions
11
README.md
11
README.md
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
> OhMyAPI == Application scaffolding for FastAPI+TortoiseORM.
|
||||
|
||||
OhMyAPI is a blazingly fast, async Python web application framework with batteries included.
|
||||
It is built around FastAPI and TortoiseORM and is thus 100% async.
|
||||
OhMyAPI is a Django-flavored web-application scaffolding framework.
|
||||
It is blazingly fast, async and has batteries included.
|
||||
Built around FastAPI and TortoiseORM makes it 100% async.
|
||||
|
||||
Features:
|
||||
|
||||
|
|
@ -23,7 +24,7 @@ Features:
|
|||
**Creating a Project**
|
||||
|
||||
```
|
||||
pip install ohmyapi # TODO: not yet published
|
||||
pip install ohmyapi
|
||||
ohmyapi startproject myproject
|
||||
cd myproject
|
||||
```
|
||||
|
|
@ -93,13 +94,13 @@ router = APIRouter(prefix="/myapp")
|
|||
|
||||
@router.get("/")
|
||||
async def list():
|
||||
return await Person.all()
|
||||
return await Person.Schema.many.from_queryset(Person.all())
|
||||
|
||||
|
||||
@router.get("/:id")
|
||||
async def get(id: int):
|
||||
try:
|
||||
await Person.get(pk=id)
|
||||
return await Person.Schema.one(Person.get(pk=id))
|
||||
except DoesNotExist:
|
||||
raise HTTPException(status_code=404, detail="item not found")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue