mirror of
https://github.com/fastapi-admin/fastapi-admin.git
synced 2025-08-16 11:54:15 +08:00
update README.rst
update version 0.2.4
This commit is contained in:
29
README.rst
29
README.rst
@ -39,8 +39,8 @@ Screenshots
|
|||||||
Quick Start
|
Quick Start
|
||||||
===========
|
===========
|
||||||
|
|
||||||
Example
|
Run Example Local
|
||||||
~~~~~~~
|
~~~~~~~~~~~~~~~~~
|
||||||
Look at `examples <https://github.com/long2ice/fastapi-admin/tree/master/examples>`_.
|
Look at `examples <https://github.com/long2ice/fastapi-admin/tree/master/examples>`_.
|
||||||
|
|
||||||
1. ``git clone https://github.com/long2ice/fastapi-admin.git``.
|
1. ``git clone https://github.com/long2ice/fastapi-admin.git``.
|
||||||
@ -74,14 +74,27 @@ Look at `examples <https://github.com/long2ice/fastapi-admin/tree/master/example
|
|||||||
|
|
||||||
Open ``http://localhost:8080/`` in browser and enjoy it!
|
Open ``http://localhost:8080/`` in browser and enjoy it!
|
||||||
|
|
||||||
Backend
|
Backend Integration
|
||||||
~~~~~~~
|
~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. code-block:: shell
|
.. code-block:: shell
|
||||||
|
|
||||||
$ pip3 install fastapi-admin
|
$ pip3 install fastapi-admin
|
||||||
|
|
||||||
Only you should do is running a fastapi app and mount admin app from fastapi-admin,then call ``init(...)``.
|
.. code-block:: python
|
||||||
|
|
||||||
|
fast_app = FastAPI()
|
||||||
|
|
||||||
|
register_tortoise(fast_app, config=TORTOISE_ORM, generate_schemas=True)
|
||||||
|
|
||||||
|
fast_app.mount('/admin', admin_app)
|
||||||
|
admin_app.init(
|
||||||
|
user_model='User',
|
||||||
|
admin_secret='test',
|
||||||
|
models='examples.models',
|
||||||
|
permission=True,
|
||||||
|
site=Site(...)
|
||||||
|
)
|
||||||
|
|
||||||
Front
|
Front
|
||||||
~~~~~
|
~~~~~
|
||||||
@ -177,7 +190,7 @@ Defined ``menu.search_fields`` in ``menu`` will render a search form by fields.
|
|||||||
|
|
||||||
Xlsx Export
|
Xlsx Export
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
FastAPI-admin can export searched data to excel file when define ``{export : True}`` in ``menu.actions``.
|
FastAPI-admin can export searched data to excel file when define ``export=True`` in ``menu``.
|
||||||
|
|
||||||
Bulk Actions
|
Bulk Actions
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
@ -203,7 +216,7 @@ Current FastAPI-admin support builtin bulk action ``delete_all``,if you want wri
|
|||||||
from fastapi_admin.factory import app as admin_app
|
from fastapi_admin.factory import app as admin_app
|
||||||
|
|
||||||
@admin_app.post(
|
@admin_app.post(
|
||||||
'/{resource}/bulk/delete' # delete is defined before.
|
'/rest/{resource}/bulk/delete' # `delete` is defined in Menu before.
|
||||||
)
|
)
|
||||||
async def bulk_delete(
|
async def bulk_delete(
|
||||||
bulk_in: BulkIn,
|
bulk_in: BulkIn,
|
||||||
|
@ -114,7 +114,7 @@ def create_app():
|
|||||||
Menu(
|
Menu(
|
||||||
name='Config',
|
name='Config',
|
||||||
url='/rest/Config',
|
url='/rest/Config',
|
||||||
icon='fa fa-pencil'
|
icon='fa fa-pencil',
|
||||||
),
|
),
|
||||||
Menu(
|
Menu(
|
||||||
name='External',
|
name='External',
|
||||||
@ -143,17 +143,26 @@ def create_app():
|
|||||||
Menu(
|
Menu(
|
||||||
name='Role',
|
name='Role',
|
||||||
url='/rest/Role',
|
url='/rest/Role',
|
||||||
icon='fa fa-group'
|
icon='fa fa-group',
|
||||||
|
actions={
|
||||||
|
'delete': False
|
||||||
|
}
|
||||||
),
|
),
|
||||||
Menu(
|
Menu(
|
||||||
name='Permission',
|
name='Permission',
|
||||||
url='/rest/Permission',
|
url='/rest/Permission',
|
||||||
icon='fa fa-user-plus'
|
icon='fa fa-user-plus',
|
||||||
|
actions={
|
||||||
|
'delete': False
|
||||||
|
}
|
||||||
),
|
),
|
||||||
Menu(
|
Menu(
|
||||||
name='Logout',
|
name='Logout',
|
||||||
url='/logout',
|
url='/logout',
|
||||||
icon='fa fa-lock'
|
icon='fa fa-lock',
|
||||||
|
actions={
|
||||||
|
'delete': False
|
||||||
|
}
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
from . import routes
|
from . import routes
|
||||||
|
|
||||||
__version__ = '0.2.3'
|
__version__ = '0.2.4'
|
||||||
|
@ -26,7 +26,9 @@ class Menu(BaseModel):
|
|||||||
sort_fields: Optional[Set[str]] = set()
|
sort_fields: Optional[Set[str]] = set()
|
||||||
# define field type,like select,radiolist,text,date
|
# define field type,like select,radiolist,text,date
|
||||||
fields_type: Dict = {}
|
fields_type: Dict = {}
|
||||||
|
# define field attr,like cols which in bootstrap table
|
||||||
attrs: Dict[str, Dict] = {}
|
attrs: Dict[str, Dict] = {}
|
||||||
|
# active table export
|
||||||
export: bool = True
|
export: bool = True
|
||||||
actions: Optional[Dict]
|
actions: Optional[Dict]
|
||||||
bulk_actions: List[Dict] = [{
|
bulk_actions: List[Dict] = [{
|
||||||
|
Reference in New Issue
Block a user