mirror of
https://github.com/fastapi-admin/fastapi-admin.git
synced 2025-08-14 10:47:30 +08:00
update docs
This commit is contained in:
1
docs/en/docs/custom/admin_log.md
Normal file
1
docs/en/docs/custom/admin_log.md
Normal file
@ -0,0 +1 @@
|
||||
# Admin Log Provider
|
1
docs/en/docs/custom/permission.md
Normal file
1
docs/en/docs/custom/permission.md
Normal file
@ -0,0 +1 @@
|
||||
# Permission Provider
|
1
docs/en/docs/custom/search.md
Normal file
1
docs/en/docs/custom/search.md
Normal file
@ -0,0 +1 @@
|
||||
# Search Provider
|
@ -10,7 +10,7 @@ You can install from pypi.
|
||||
|
||||
## From source
|
||||
|
||||
Or you can install from source with latest code.
|
||||
Or you can install from source with the latest code.
|
||||
|
||||
```shell
|
||||
> pip install git+https://github.com/fastapi-admin/fastapi-admin.git
|
||||
@ -21,7 +21,7 @@ Or you can install from source with latest code.
|
||||
Add the following line.
|
||||
|
||||
```
|
||||
-e https://github.com/fastapi-admin/fastapi-admin.git@develop#egg=fastapi-admin
|
||||
-e https://github.com/fastapi-admin/fastapi-admin.git#egg=fastapi-admin
|
||||
```
|
||||
|
||||
### With poetry
|
||||
@ -29,5 +29,5 @@ Add the following line.
|
||||
Add the following line in section `[tool.poetry.dependencies]`.
|
||||
|
||||
```toml
|
||||
fastapi-admin = { git = 'https://github.com/fastapi-admin/fastapi-admin.git', branch = 'develop' }
|
||||
fastapi-admin = { git = 'https://github.com/fastapi-admin/fastapi-admin.git' }
|
||||
```
|
||||
|
@ -62,7 +62,7 @@ from fastapi_admin.resources import Link
|
||||
@app.register
|
||||
class Home(Link):
|
||||
label = "Home"
|
||||
icon = "ti ti-home"
|
||||
icon = "fas fa-home"
|
||||
url = "/admin"
|
||||
```
|
||||
|
||||
@ -76,19 +76,22 @@ The `Model` make a TortoiseORM model as a menu with CURD page.
|
||||
|
||||
```python
|
||||
|
||||
from examples.models import User
|
||||
from examples.models import Admin
|
||||
from fastapi_admin.app import app
|
||||
from fastapi_admin.resources import Field, Model
|
||||
from fastapi_admin.resources import Field, Model,Action
|
||||
from fastapi_admin.widgets import displays, filters, inputs
|
||||
from typing import List
|
||||
from fastapi_admin.providers.file_upload import FileUploadProvider
|
||||
|
||||
upload_provider = FileUploadProvider(uploads_dir=os.path.join(BASE_DIR, "static", "uploads"))
|
||||
|
||||
@app.register
|
||||
class UserResource(Model):
|
||||
label = "User"
|
||||
model = User
|
||||
icon = "ti ti-user"
|
||||
page_pre_title = "user list"
|
||||
page_title = "user model"
|
||||
class AdminResource(Model):
|
||||
label = "Admin"
|
||||
model = Admin
|
||||
icon = "fas fa-user"
|
||||
page_pre_title = "admin list"
|
||||
page_title = "admin model"
|
||||
filters = [
|
||||
filters.Search(
|
||||
name="username", label="Name", search_mode="contains", placeholder="Search for username"
|
||||
@ -111,10 +114,15 @@ class UserResource(Model):
|
||||
display=displays.Image(width="40"),
|
||||
input_=inputs.Image(null=True, upload_provider=upload_provider),
|
||||
),
|
||||
"is_superuser",
|
||||
"is_active",
|
||||
"created_at",
|
||||
]
|
||||
can_create = False
|
||||
|
||||
def get_actions(self) -> List[Action]:
|
||||
return []
|
||||
|
||||
def get_bulk_actions(self) -> List[Action]:
|
||||
return []
|
||||
```
|
||||
|
||||
### Dropdown
|
||||
@ -158,7 +166,7 @@ class Content(Dropdown):
|
||||
]
|
||||
|
||||
label = "Content"
|
||||
icon = "ti ti-package"
|
||||
icon = "fas fa-bars"
|
||||
resources = [ProductResource, CategoryResource]
|
||||
```
|
||||
|
||||
|
@ -68,3 +68,17 @@ admin_app.configure(maintenance=True)
|
||||
```
|
||||
|
||||
## Admin Log
|
||||
|
||||
If you want to log all `create/update/delete` actions, you can set `admin_log_provider` to `admin_app.configure(...)`.
|
||||
|
||||
```python
|
||||
admin_app.configure(admin_log_provider=AdminLogProvider(Log))
|
||||
```
|
||||
|
||||
## Site Search
|
||||
|
||||
You can enable site search by set `search_provider` to `admin_app.configure(...)`.
|
||||
|
||||
```python
|
||||
admin_app.configure(search_provider=SearchProvider())
|
||||
```
|
||||
|
@ -22,7 +22,7 @@ In order to access the repository programmatically (from the command line or Git
|
||||
Add the following line in section `[tool.poetry.dependencies]`.
|
||||
|
||||
```toml
|
||||
fastapi-admin-pro = { git = 'https://${GH_TOKEN}@github.com/fastapi-admin/fastapi-admin-pro.git', branch = 'develop' }
|
||||
fastapi-admin-pro = { git = 'https://${GH_TOKEN}@github.com/fastapi-admin/fastapi-admin-pro.git'}
|
||||
```
|
||||
|
||||
## In requirements.txt
|
||||
@ -30,5 +30,5 @@ fastapi-admin-pro = { git = 'https://${GH_TOKEN}@github.com/fastapi-admin/fastap
|
||||
Add the following line.
|
||||
|
||||
```shell
|
||||
-e https://${GH_TOKEN}@github.com/fastapi-admin/fastapi-admin-pro.git@develop#egg=fastapi-admin-pro
|
||||
-e https://${GH_TOKEN}@github.com/fastapi-admin/fastapi-admin-pro.git#egg=fastapi-admin-pro
|
||||
```
|
||||
|
1
docs/en/docs/reference/errors.md
Normal file
1
docs/en/docs/reference/errors.md
Normal file
@ -0,0 +1 @@
|
||||
# Error Pages (💗 Pro only)
|
@ -28,7 +28,7 @@ Current support `zh` and `en`, default is `en`.
|
||||
|
||||
## template_folders
|
||||
|
||||
Template folders used to override builtin templates.
|
||||
Template folders registered to jinja2 and also can be used to override builtin templates.
|
||||
|
||||
## login_provider
|
||||
|
||||
@ -45,7 +45,8 @@ Show captcha in admin login page.
|
||||
|
||||
## permission_provider (💗 Pro only)
|
||||
|
||||
You can enable permission control by setting `permission_provider`.
|
||||
You can enable permission control by setting `permission_provider`, which is instance
|
||||
of `fastapi_admin.providers.permission.PermissionProvider` of its subclass.
|
||||
|
||||
### admin_model
|
||||
|
||||
@ -59,14 +60,11 @@ Subclass of `fastapi_admin.models.AbstractResource`.
|
||||
|
||||
Subclass of `fastapi_admin.models.AbstractPermission`.
|
||||
|
||||
### role_model
|
||||
## admin_log_provider
|
||||
|
||||
Subclass of `fastapi_admin.models.AbstractRole`.
|
||||
|
||||
## log_model
|
||||
|
||||
You can enable action log by set `log_model`, which is subclass of `fastapi_admin.models.AbstractLog`. After set that,
|
||||
all `delete/create/update` for model will be recorded.
|
||||
You can enable action log by set `admin_log_provider`, which is instance
|
||||
of `fastapi_admin.providers.admin_log.AdminLogProvider` or its subclass. After set that, all `delete/create/update` for
|
||||
model will be recorded.
|
||||
|
||||
## search_provider (💗 Pro only)
|
||||
|
||||
|
@ -12,7 +12,7 @@ Nav bar menu name.
|
||||
|
||||
### icon
|
||||
|
||||
Icon name comes from <https://tabler-icons.io>, like `ti ti-user` will display a user icon in menu.
|
||||
Icon name comes from <https://fontawesome.com>, like `fas fa-user` will display a user icon in menu.
|
||||
|
||||
## Link
|
||||
|
||||
|
@ -53,12 +53,16 @@ nav:
|
||||
- reference/global_search.md
|
||||
- reference/actions.md
|
||||
- reference/bulk_actions.md
|
||||
- reference/errors.md
|
||||
- Customization:
|
||||
- custom/page.md
|
||||
- custom/overwrite.md
|
||||
- custom/widget.md
|
||||
- custom/login.md
|
||||
- custom/file.md
|
||||
- custom/widget.md
|
||||
- custom/search.md
|
||||
- custom/admin_log.md
|
||||
- custom/permission.md
|
||||
- Pro Version For Sponsor:
|
||||
- pro/sponsor.md
|
||||
- pro/exclusive.md
|
||||
|
@ -126,3 +126,11 @@ class DocumentationLink(Link):
|
||||
url = "https://long2ice.github.io/fastadmin"
|
||||
icon = "fas fa-file-code"
|
||||
target = "_blank"
|
||||
|
||||
|
||||
@app.register
|
||||
class ProLink(Link):
|
||||
label = "Pro Version"
|
||||
url = "https://fastapi-admin-pro.long2ice.cn"
|
||||
icon = "far fa-heart"
|
||||
target = "_blank"
|
||||
|
Reference in New Issue
Block a user