From 4ebd2f80df216c39ce78f3457f77b8c766bb5ce5 Mon Sep 17 00:00:00 2001 From: long2ice Date: Mon, 13 Apr 2020 16:42:03 +0800 Subject: [PATCH] add annotation and update README.rst --- README.rst | 6 +++--- fastapi_admin/site.py | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index dc46551..7a2dc3f 100644 --- a/README.rst +++ b/README.rst @@ -81,7 +81,7 @@ Only you should do is runing a fastapi app and mount admin app from fastapi-admi @admin_app.post( - '/{resource}/bulk/test_bulk' + '/{resource}/bulk/test_bulk' # must be format with /{resource}/bulk/ ) async def test_bulk( bulk_in: BulkIn, @@ -132,8 +132,8 @@ Only you should do is runing a fastapi app and mount admin app from fastapi-admi 'text': 'delete_all', } , { - 'value': 'test_bulk', - 'text': 'TestBulk' + 'value': 'test_bulk', # this is the action need in fastapi route. + 'text': 'TestBulk' # will show in front. } ] ), diff --git a/fastapi_admin/site.py b/fastapi_admin/site.py index b92b0c9..a80084f 100644 --- a/fastapi_admin/site.py +++ b/fastapi_admin/site.py @@ -5,10 +5,12 @@ from pydantic import BaseModel, HttpUrl class Menu(BaseModel): name: str + # whether is it a title or a model resource. title: Optional[bool] + # must be format with /rest/ if it's a model resource. url: Optional[str] icon: Optional[str] - # children meun + # children menu children: Optional[List['Menu']] = [] # include fields include: Optional[Tuple[str]]