From 8c62b68dc87514d9257b14f765d89fab6f55af21 Mon Sep 17 00:00:00 2001 From: long2ice Date: Wed, 28 Apr 2021 22:31:51 +0800 Subject: [PATCH] update docs --- .github/workflows/deploy.yml | 41 +++++ .github/workflows/pypi.yml | 2 +- .gitignore | 2 +- Dockerfile | 2 +- docker-compose.yml | 18 +- docs/en/docs/custom/file.md | 1 + docs/en/docs/custom/login.md | 1 + docs/en/docs/custom/overwrite.md | 1 + docs/en/docs/custom/page.md | 1 + docs/en/docs/custom/widget.md | 1 + docs/en/docs/getting_started/quickstart.md | 98 +++++++++- docs/en/docs/pro/index.md | 52 +++++- docs/en/docs/pro/installation.md | 33 ++++ docs/en/docs/pro/sponsor.md | 22 +++ docs/en/docs/reference/configuration.md | 42 +++++ docs/en/docs/reference/file_upload.md | 6 + docs/en/docs/reference/middleware.md | 2 + docs/en/docs/reference/resource.md | 8 + docs/en/mkdocs.yml | 10 +- .../extension => zh/docs/custom}/index.md | 0 docs/zh/docs/getting_started/index.md | 1 + docs/zh/docs/getting_started/installation.md | 33 ++++ docs/zh/docs/getting_started/quickstart.md | 167 ++++++++++++++++++ docs/zh/docs/pro/index.md | 15 ++ docs/zh/docs/pro/installation.md | 1 + docs/zh/docs/pro/sponsor.md | 1 + docs/zh/docs/reference/configuration.md | 1 + docs/zh/docs/reference/file_upload.md | 1 + docs/zh/docs/reference/middleware.md | 1 + docs/zh/docs/reference/resource.md | 1 + docs/zh/docs/reference/widget/display.md | 0 docs/zh/docs/reference/widget/filter.md | 0 docs/zh/docs/reference/widget/input.md | 0 docs/zh/mkdocs.yml | 28 ++- examples/main.py | 2 +- poetry.lock | 25 +-- pyproject.toml | 1 - 37 files changed, 568 insertions(+), 53 deletions(-) create mode 100644 .github/workflows/deploy.yml create mode 100644 docs/en/docs/custom/file.md create mode 100644 docs/en/docs/custom/login.md create mode 100644 docs/en/docs/custom/overwrite.md create mode 100644 docs/en/docs/custom/page.md create mode 100644 docs/en/docs/custom/widget.md rename docs/{en/docs/extension => zh/docs/custom}/index.md (100%) create mode 120000 docs/zh/docs/getting_started/index.md create mode 100644 docs/zh/docs/getting_started/installation.md create mode 100644 docs/zh/docs/getting_started/quickstart.md create mode 100644 docs/zh/docs/pro/index.md create mode 100644 docs/zh/docs/pro/installation.md create mode 100644 docs/zh/docs/pro/sponsor.md create mode 100644 docs/zh/docs/reference/configuration.md create mode 100644 docs/zh/docs/reference/file_upload.md create mode 100644 docs/zh/docs/reference/middleware.md create mode 100644 docs/zh/docs/reference/resource.md create mode 100644 docs/zh/docs/reference/widget/display.md create mode 100644 docs/zh/docs/reference/widget/filter.md create mode 100644 docs/zh/docs/reference/widget/input.md diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..fe41950 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,41 @@ +name: deploy +on: [push, pull_request] +jobs: + example: + runs-on: ubuntu-latest + steps: + - name: Deploy + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: ${{ secrets.PORT }} + script: | + cd /root/fastapi-admin/ + git pull + docker-compose up -d --build + gh-pages: + runs-on: ubuntu-latest + steps: + - name: Install and configure Poetry + uses: snok/install-poetry@v1.1.1 + with: + virtualenvs-create: false + - name: Install deps + run: make deps + - name: Build en + run: cd docs/en && mkdocs build + - name: Deploy en + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/en/site + - name: Build zh + run: cd docs/zh && mkdocs build + - name: Deploy zh + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/zh/site + destination_dir: zh diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 080f33b..55ae4ac 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v1 with: - python-version: '3.x' + python-version: "3.x" - name: Install and configure Poetry uses: snok/install-poetry@v1.1.1 with: diff --git a/.gitignore b/.gitignore index df5623a..8730e8a 100644 --- a/.gitignore +++ b/.gitignore @@ -120,7 +120,7 @@ venv.bak/ .ropeproject # mkdocs documentation -/site +site/ # mypy .mypy_cache/ diff --git a/Dockerfile b/Dockerfile index 95600c2..8bd92a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.7 +FROM python:3 RUN mkdir -p /fastapi-admin WORKDIR /fastapi-admin COPY pyproject.toml poetry.lock /fastapi-admin/ diff --git a/docker-compose.yml b/docker-compose.yml index d90a3e4..751b6ef 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,21 +1,11 @@ -version: '3' +version: "3" services: - mysql: - image: mysql - environment: - MYSQL_ROOT_PASSWORD: 123456 - MYSQL_DATABASE: fastapi-admin - healthcheck: - test: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10 - api: + app: build: . restart: always environment: - DATABASE_URL: mysql://root:123456@mysql:3306/fastapi-admin + DATABASE_URL: mysql://root:123456@127.0.0.1:3306/fastapi-admin TZ: Asia/Shanghai - ports: - - '8000:8000' - depends_on: - - mysql + network_mode: host image: fastapi-admin command: uvicorn examples.main:app --port 8000 --host 0.0.0.0 diff --git a/docs/en/docs/custom/file.md b/docs/en/docs/custom/file.md new file mode 100644 index 0000000..8d4cd52 --- /dev/null +++ b/docs/en/docs/custom/file.md @@ -0,0 +1 @@ +# File Upload Provider diff --git a/docs/en/docs/custom/login.md b/docs/en/docs/custom/login.md new file mode 100644 index 0000000..a85a769 --- /dev/null +++ b/docs/en/docs/custom/login.md @@ -0,0 +1 @@ +# Login Provider diff --git a/docs/en/docs/custom/overwrite.md b/docs/en/docs/custom/overwrite.md new file mode 100644 index 0000000..09ea6a4 --- /dev/null +++ b/docs/en/docs/custom/overwrite.md @@ -0,0 +1 @@ +# Override builtin pages and widgets diff --git a/docs/en/docs/custom/page.md b/docs/en/docs/custom/page.md new file mode 100644 index 0000000..eb34f35 --- /dev/null +++ b/docs/en/docs/custom/page.md @@ -0,0 +1 @@ +# Custom Page diff --git a/docs/en/docs/custom/widget.md b/docs/en/docs/custom/widget.md new file mode 100644 index 0000000..dd159bb --- /dev/null +++ b/docs/en/docs/custom/widget.md @@ -0,0 +1 @@ +# Widget diff --git a/docs/en/docs/getting_started/quickstart.md b/docs/en/docs/getting_started/quickstart.md index acd249a..c92f23d 100644 --- a/docs/en/docs/getting_started/quickstart.md +++ b/docs/en/docs/getting_started/quickstart.md @@ -66,14 +66,102 @@ class Home(Link): url = "/admin" ``` -### Field - -The `Field` is used in `Model` resource to define how to display and input every field in model. - ### Model -The `Model` make a TortoiseORM model as a menu with CURD actions. +#### Field + +The `Field` is used in `Model` resource to define how to display and input every field in model page. + +The `Model` make a TortoiseORM model as a menu with CURD page. + +```python + +from examples.models import User +from fastapi_admin.app import app +from fastapi_admin.resources import Field, Model +from fastapi_admin.widgets import displays, filters, inputs + + +@app.register +class UserResource(Model): + label = "User" + model = User + icon = "ti ti-user" + page_pre_title = "user list" + page_title = "user model" + filters = [ + filters.Search( + name="username", label="Name", search_mode="contains", placeholder="Search for username" + ), + filters.Date(name="created_at", label="CreatedAt"), + ] + fields = [ + "id", + "username", + Field( + name="password", + label="Password", + display=displays.InputOnly(), + input_=inputs.Password(), + ), + Field(name="email", label="Email", input_=inputs.Email()), + Field( + name="avatar", + label="Avatar", + display=displays.Image(width="40"), + input_=inputs.Image(null=True, upload_provider=upload_provider), + ), + "is_superuser", + "is_active", + "created_at", + ] +``` ### Dropdown The `Dropdown` can contains both `Link` and `Model`, which can be nested. + +```python + + +from examples import enums +from examples.models import Category, Product +from fastapi_admin.app import app +from fastapi_admin.resources import Dropdown, Field, Model +from fastapi_admin.widgets import displays, filters + + +@app.register +class Content(Dropdown): + class CategoryResource(Model): + label = "Category" + model = Category + fields = ["id", "name", "slug", "created_at"] + + class ProductResource(Model): + label = "Product" + model = Product + filters = [ + filters.Enum(enum=enums.ProductType, name="type", label="ProductType"), + filters.Datetime(name="created_at", label="CreatedAt"), + ] + fields = [ + "id", + "name", + "view_num", + "sort", + "is_reviewed", + "type", + Field(name="image", label="Image", display=displays.Image(width="40")), + "body", + "created_at", + ] + + label = "Content" + icon = "ti ti-package" + resources = [ProductResource, CategoryResource] +``` + +### What's next? + +That's all, you can run your app now. For more reference you can see [Reference](/reference). diff --git a/docs/en/docs/pro/index.md b/docs/en/docs/pro/index.md index d001b25..fcdc809 100644 --- a/docs/en/docs/pro/index.md +++ b/docs/en/docs/pro/index.md @@ -1,15 +1,59 @@ -# Content +# Exclusive content ## Login Captcha +You can set captcha in admin login page, just set `enable_captcha=True`. + +```python +login_provider = UsernamePasswordProvider(user_model=User, enable_captcha=True) +``` + ## Failed Login IP Limitation +If you want limit login failed ip with error password, you can use `LoginPasswordMaxTryMiddleware`. + +```python +admin_app.add_middleware(BaseHTTPMiddleware, dispatch=LoginPasswordMaxTryMiddleware(max_times = 3, after_seconds = 360)) +``` + ## Additional File Upload Providers +### ALiYunOSSProvider + +### AwsS3Provider + ## Error pages +### 404 + +You can catch all `404` error to show builtin `404` page. + +```python +from fastapi_admin.exceptions import not_found_error_exception +from starlette.status import HTTP_404_NOT_FOUND + +app.add_exception_handler(HTTP_404_NOT_FOUND, not_found_error_exception) +``` + +### 500 + +You can catch all `500` error to show builtin `500` page. + +```python +from starlette.status import HTTP_500_INTERNAL_SERVER_ERROR +from fastapi_admin.exceptions import server_error_exception + +app.add_exception_handler(HTTP_500_INTERNAL_SERVER_ERROR, server_error_exception) +``` + +### Maintenance + +If your site is in maintenance, you can set `true` to `admin_app.configure(...)`. + +```python +admin_app.configure(maintenance=True) +``` + ## Free consultation -## Others - -... +Whenever you have any questions, you can send email to or open `issue` in `fastapi-admin-pro` repository, I will answer your questions as soon as possible. diff --git a/docs/en/docs/pro/installation.md b/docs/en/docs/pro/installation.md index 25267fe..5562416 100644 --- a/docs/en/docs/pro/installation.md +++ b/docs/en/docs/pro/installation.md @@ -1 +1,34 @@ # Installation + +Because pro version won't publish to pypi, so you can't install from it. + +## Requirements + +In order to access the repository programmatically (from the command line or GitHub Actions workflows), you need to create a personal access token: + +1. Go to . +2. Click on Generate a new token. +3. Enter a name and select the repo scope. +4. Generate the token and store it in a safe place. + +## With pip + +```shell +> pip install git+https://${GH_TOKEN}@github.com/fastapi-admin/fastapi-admin-pro.git +``` + +## With poetry + +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' } +``` + +## In requirements.txt + +Add the following line. + +```shell +-e https://${GH_TOKEN}@github.com/fastapi-admin/fastapi-admin-pro.git@develop#egg=fastapi-admin-pro +``` diff --git a/docs/en/docs/pro/sponsor.md b/docs/en/docs/pro/sponsor.md index 93b3f83..dc41d2b 100644 --- a/docs/en/docs/pro/sponsor.md +++ b/docs/en/docs/pro/sponsor.md @@ -1 +1,23 @@ # Sponsor + +The pro version is just for the sponsors. As a sponsor, you will be invited to [fastapi-admin](https://github.com/fastapi-admin) organization as a outside collaborator with readonly access, and you can get the pro features and get updates for a time. + +## How to become a sponsor + +Sponsor Link: + +You can choice any sponsor way you like. After sponsor, you can email me with your github account and sponsor way and account, then I will invite you to join [fastapi-admin](https://github.com/fastapi-admin) organization. + +## Levels + +### $10 - Month + +You will be invited and keep collaborator role for a month. + +### $50 - Half a Year + +You will be invited and keep collaborator role for half a year. + +### $90 - Year + +You will be invited and keep collaborator role for a year. diff --git a/docs/en/docs/reference/configuration.md b/docs/en/docs/reference/configuration.md index a025a48..bb89c3a 100644 --- a/docs/en/docs/reference/configuration.md +++ b/docs/en/docs/reference/configuration.md @@ -1 +1,43 @@ # Configuration + +The following configurations can be used to `admin_app.configure(...)`. + +## logo_url + +Will show the logo image in admin dashboard. + +## login_logo_url + +Will show the logo in login page. + +## admin_path + +Default is `/admin`, but you can change to other page. + +## maintenance (๐Ÿ’— Pro only) + +If set to `true`, all pages will be redirected to the `/maintenance` page. + +## redis + +Instance of `aioredis`. + +## default_locale + +Current support `zh` and `en`, default is `en`. + +## template_folders + +Template folders used to override builtin templates. + +## login_provider + +You can pass subclasses of `fastapi_admin.providers.login.LoginProvider`, there is a builtin `fastapi_admin.providers.login.UsernamePasswordProvider` you can use. + +### user_model + +Subclass instance of `fastapi_admin.providers.login.UserMixin`. + +### enable_captcha (๐Ÿ’— Pro only) + +Show captcha in admin login page. diff --git a/docs/en/docs/reference/file_upload.md b/docs/en/docs/reference/file_upload.md index 10e3470..c72b038 100644 --- a/docs/en/docs/reference/file_upload.md +++ b/docs/en/docs/reference/file_upload.md @@ -1 +1,7 @@ # File Upload + +## FileUploadProvider + +## ALiYunOSSProvider (๐Ÿ’— Pro only) + +## AwsS3Provider (๐Ÿ’— Pro only) diff --git a/docs/en/docs/reference/middleware.md b/docs/en/docs/reference/middleware.md index 4dd1086..f5f4bb6 100644 --- a/docs/en/docs/reference/middleware.md +++ b/docs/en/docs/reference/middleware.md @@ -1 +1,3 @@ # Middleware + +## LoginPasswordMaxTryMiddleware (๐Ÿ’— Pro only) diff --git a/docs/en/docs/reference/resource.md b/docs/en/docs/reference/resource.md index 81dcb9f..0ac6f48 100644 --- a/docs/en/docs/reference/resource.md +++ b/docs/en/docs/reference/resource.md @@ -1 +1,9 @@ # Resource + +## Link + +## Model + +### Field + +## Dropdown diff --git a/docs/en/mkdocs.yml b/docs/en/mkdocs.yml index 361c235..1b98a80 100644 --- a/docs/en/mkdocs.yml +++ b/docs/en/mkdocs.yml @@ -48,8 +48,12 @@ nav: - reference/widget/input.md - reference/file_upload.md - reference/middleware.md - - Extension: - - extension/index.md + - Custom: + - custom/page.md + - custom/overwrite.md + - custom/login.md + - custom/file.md + - custom/widget.md - Pro Version For Sponsor: - pro/index.md - pro/sponsor.md @@ -67,7 +71,7 @@ extra: copyright: Copyright © 2021 long2ice plugins: + - search - git-revision-date-localized: type: datetime - - markdownextradata dev_addr: 127.0.0.1:7999 diff --git a/docs/en/docs/extension/index.md b/docs/zh/docs/custom/index.md similarity index 100% rename from docs/en/docs/extension/index.md rename to docs/zh/docs/custom/index.md diff --git a/docs/zh/docs/getting_started/index.md b/docs/zh/docs/getting_started/index.md new file mode 120000 index 0000000..ff5c796 --- /dev/null +++ b/docs/zh/docs/getting_started/index.md @@ -0,0 +1 @@ +../../../../README.md \ No newline at end of file diff --git a/docs/zh/docs/getting_started/installation.md b/docs/zh/docs/getting_started/installation.md new file mode 100644 index 0000000..c03cd06 --- /dev/null +++ b/docs/zh/docs/getting_started/installation.md @@ -0,0 +1,33 @@ +# Installation + +## From pypi + +You can install from pypi. + +```shell +> pip install fastapi-admin +``` + +## From source + +Or you can install from source with latest code. + +```shell +> pip install git+https://github.com/fastapi-admin/fastapi-admin.git +``` + +### With requirements.txt + +Add the following line. + +``` +-e https://github.com/fastapi-admin/fastapi-admin.git@develop#egg=fastapi-admin +``` + +### With poetry + +Add the following line in section `[tool.poetry.dependencies]`. + +```toml +fastapi-admin = { git = 'https://github.com/fastapi-admin/fastapi-admin.git', branch = 'develop' } +``` diff --git a/docs/zh/docs/getting_started/quickstart.md b/docs/zh/docs/getting_started/quickstart.md new file mode 100644 index 0000000..06d37c2 --- /dev/null +++ b/docs/zh/docs/getting_started/quickstart.md @@ -0,0 +1,167 @@ +# Quickstart + +`FastAPI-Admin` is easy to mount your `FastAPI` app, just need a few configs. + +## Mount Admin App + +First, you need mount the admin app from `FastAPI-Admin` as a sub application of `FastAPI`. + +```python +from fastapi_admin.app import app as admin_app +from fastapi import FastAPI + +app = FastAPI() +app.mount("/admin", admin_app) + +``` + +## Configure Admin App + +There are some configs to configure the admin app, and you need to configure it on startup of `FastAPI`. + +```python +from fastapi_admin.app import app as admin_app +from fastapi_admin.providers.login import UsernamePasswordProvider +from examples.models import User +import aioredis +from fastapi import FastAPI + +login_provider = UsernamePasswordProvider(user_model=User, enable_captcha=True) + +app = FastAPI() + + +@app.on_event("startup") +async def startup(): + redis = await aioredis.create_redis_pool("redis://localhost", encoding="utf8") + admin_app.configure( + logo_url="https://preview.tabler.io/static/logo-white.svg", + login_logo_url="https://preview.tabler.io/static/logo.svg", + template_folders=[os.path.join(BASE_DIR, "templates")], + login_provider=login_provider, + maintenance=False, + redis=redis, + ) +``` + +The full list of configs and detail can be found in [Configuration](/reference/configuration). + +## Define And Register Resource + +There are three kinds of resources, which are `Link`,`Model`, and `Dropdown`. + +### Link + +The `Link` will display a menu in sidebar with custom page or third page. + +```python +from fastapi_admin.app import app +from fastapi_admin.resources import Link + + +@app.register +class Home(Link): + label = "Home" + icon = "ti ti-home" + url = "/admin" +``` + +### Field + +The `Field` is used in `Model` resource to define how to display and input every field in model page. + +### Model + +The `Model` make a TortoiseORM model as a menu with CURD page. + +```python + +from examples.models import User +from fastapi_admin.app import app +from fastapi_admin.resources import Field, Model +from fastapi_admin.widgets import displays, filters, inputs + + +@app.register +class UserResource(Model): + label = "User" + model = User + icon = "ti ti-user" + page_pre_title = "user list" + page_title = "user model" + filters = [ + filters.Search( + name="username", label="Name", search_mode="contains", placeholder="Search for username" + ), + filters.Date(name="created_at", label="CreatedAt"), + ] + fields = [ + "id", + "username", + Field( + name="password", + label="Password", + display=displays.InputOnly(), + input_=inputs.Password(), + ), + Field(name="email", label="Email", input_=inputs.Email()), + Field( + name="avatar", + label="Avatar", + display=displays.Image(width="40"), + input_=inputs.Image(null=True, upload_provider=upload_provider), + ), + "is_superuser", + "is_active", + "created_at", + ] +``` + +### Dropdown + +The `Dropdown` can contains both `Link` and `Model`, which can be nested. + +```python + + +from examples import enums +from examples.models import Category, Product +from fastapi_admin.app import app +from fastapi_admin.resources import Dropdown, Field, Model +from fastapi_admin.widgets import displays, filters + + +@app.register +class Content(Dropdown): + class CategoryResource(Model): + label = "Category" + model = Category + fields = ["id", "name", "slug", "created_at"] + + class ProductResource(Model): + label = "Product" + model = Product + filters = [ + filters.Enum(enum=enums.ProductType, name="type", label="ProductType"), + filters.Datetime(name="created_at", label="CreatedAt"), + ] + fields = [ + "id", + "name", + "view_num", + "sort", + "is_reviewed", + "type", + Field(name="image", label="Image", display=displays.Image(width="40")), + "body", + "created_at", + ] + + label = "Content" + icon = "ti ti-package" + resources = [ProductResource, CategoryResource] +``` + +### What's next? + +That's all, you can run your app now. For more reference you can see [Reference](/reference). diff --git a/docs/zh/docs/pro/index.md b/docs/zh/docs/pro/index.md new file mode 100644 index 0000000..d001b25 --- /dev/null +++ b/docs/zh/docs/pro/index.md @@ -0,0 +1,15 @@ +# Content + +## Login Captcha + +## Failed Login IP Limitation + +## Additional File Upload Providers + +## Error pages + +## Free consultation + +## Others + +... diff --git a/docs/zh/docs/pro/installation.md b/docs/zh/docs/pro/installation.md new file mode 100644 index 0000000..25267fe --- /dev/null +++ b/docs/zh/docs/pro/installation.md @@ -0,0 +1 @@ +# Installation diff --git a/docs/zh/docs/pro/sponsor.md b/docs/zh/docs/pro/sponsor.md new file mode 100644 index 0000000..93b3f83 --- /dev/null +++ b/docs/zh/docs/pro/sponsor.md @@ -0,0 +1 @@ +# Sponsor diff --git a/docs/zh/docs/reference/configuration.md b/docs/zh/docs/reference/configuration.md new file mode 100644 index 0000000..a025a48 --- /dev/null +++ b/docs/zh/docs/reference/configuration.md @@ -0,0 +1 @@ +# Configuration diff --git a/docs/zh/docs/reference/file_upload.md b/docs/zh/docs/reference/file_upload.md new file mode 100644 index 0000000..10e3470 --- /dev/null +++ b/docs/zh/docs/reference/file_upload.md @@ -0,0 +1 @@ +# File Upload diff --git a/docs/zh/docs/reference/middleware.md b/docs/zh/docs/reference/middleware.md new file mode 100644 index 0000000..4dd1086 --- /dev/null +++ b/docs/zh/docs/reference/middleware.md @@ -0,0 +1 @@ +# Middleware diff --git a/docs/zh/docs/reference/resource.md b/docs/zh/docs/reference/resource.md new file mode 100644 index 0000000..81dcb9f --- /dev/null +++ b/docs/zh/docs/reference/resource.md @@ -0,0 +1 @@ +# Resource diff --git a/docs/zh/docs/reference/widget/display.md b/docs/zh/docs/reference/widget/display.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/zh/docs/reference/widget/filter.md b/docs/zh/docs/reference/widget/filter.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/zh/docs/reference/widget/input.md b/docs/zh/docs/reference/widget/input.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/zh/mkdocs.yml b/docs/zh/mkdocs.yml index e11ed28..55e8ea4 100644 --- a/docs/zh/mkdocs.yml +++ b/docs/zh/mkdocs.yml @@ -5,10 +5,10 @@ site_description: A fast admin dashboard based on FastAPI and TortoiseORM with t repo_name: fastapi-admin/fastapi-admin site_author: long2ice theme: - logo: https://fastapi.tiangolo.com/img/icon-white.svg - favicon: https://fastapi.tiangolo.com/img/favicon.png + logo: https://raw.githubusercontent.com/fastapi-admin/fastapi-admin/dev/images/icon-white.svg + favicon: https://raw.githubusercontent.com/fastapi-admin/fastapi-admin/dev/images/favicon.png name: material - language: zh + language: en icon: repo: fontawesome/brands/github palette: @@ -35,11 +35,25 @@ markdown_extensions: - pymdownx.inlinehilite - pymdownx.superfences nav: - - ้ฆ–้กต: index.md - ๅ…ฅ้—จๆŒ‡ๅ—: - - getting_started.md - - Pro ็‰นๆ€ง: + - getting_started/index.md + - getting_started/installation.md + - getting_started/quickstart.md + - ๅ‚่€ƒ: + - reference/configuration.md + - reference/resource.md + - ็ป„ไปถ: + - reference/widget/filter.md + - reference/widget/display.md + - reference/widget/input.md + - reference/file_upload.md + - reference/middleware.md + - ่‡ชๅฎšไน‰: + - custom/index.md + - ่ตžๅŠฉ่€… Pro ็‰ˆๆœฌ: + - pro/index.md - pro/sponsor.md + - pro/installation.md extra: alternate: - name: English @@ -55,3 +69,5 @@ copyright: Copyright © 2021 long2ice plugins: - git-revision-date-localized: type: datetime + - markdownextradata +dev_addr: 127.0.0.1:7999 diff --git a/examples/main.py b/examples/main.py index a261d67..5bc2f18 100644 --- a/examples/main.py +++ b/examples/main.py @@ -1,5 +1,6 @@ import os +import aioredis import uvicorn from fastapi import FastAPI from starlette.middleware.cors import CORSMiddleware @@ -11,7 +12,6 @@ from examples.constants import BASE_DIR from examples.models import User from fastapi_admin.app import app as admin_app from fastapi_admin.providers.login import UsernamePasswordProvider -import aioredis login_provider = UsernamePasswordProvider(user_model=User, enable_captcha=True) diff --git a/poetry.lock b/poetry.lock index 894a4d3..41dbeda 100644 --- a/poetry.lock +++ b/poetry.lock @@ -428,18 +428,6 @@ babel = ">=2.7.0" GitPython = "*" mkdocs = ">=1.0" -[[package]] -name = "mkdocs-markdownextradata-plugin" -version = "0.2.4" -description = "A MkDocs plugin that injects the mkdocs.yml extra variables into the markdown template" -category = "dev" -optional = false -python-versions = ">=2.7.9,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*" - -[package.dependencies] -mkdocs = "*" -pyyaml = "*" - [[package]] name = "mkdocs-material" version = "7.1.3" @@ -899,7 +887,7 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pyt [metadata] lock-version = "1.1" python-versions = "^3.7" -content-hash = "3f9c88790071d1b81d5befdb3c20a47ca70a111be58492dae51ffca81b5283e1" +content-hash = "c3b7114e0cfcc5ec6fb8cfb066a61922096068d0e9ff2e60b69f2162e5d2ab44" [metadata.files] aiofiles = [ @@ -1200,9 +1188,6 @@ mkdocs-git-revision-date-localized-plugin = [ {file = "mkdocs-git-revision-date-localized-plugin-0.9.tar.gz", hash = "sha256:49e59396f1e83264b8f54fcb339a9137925a1af19e639f03dc59dae7f22e914f"}, {file = "mkdocs_git_revision_date_localized_plugin-0.9-py3-none-any.whl", hash = "sha256:5d319398e9ce325d02df1cba232a92b215f8d0c0ffd3810b6a61d6c5eb6306e6"}, ] -mkdocs-markdownextradata-plugin = [ - {file = "mkdocs_markdownextradata_plugin-0.2.4-py3-none-any.whl", hash = "sha256:9acf1860488e8e990c77de2af2e575b36dfc2a24c46ac63789315f78d2a3b709"}, -] mkdocs-material = [ {file = "mkdocs-material-7.1.3.tar.gz", hash = "sha256:e34bba93ad1a0e6f9afc371f4ef55bedabbf13b9a786b013b0ce26ac55ec2932"}, {file = "mkdocs_material-7.1.3-py2.py3-none-any.whl", hash = "sha256:437638b0de7a9113d7f1c9ddc93c0a29a3b808c71c3606713d8c1fa437697a3e"}, @@ -1353,18 +1338,26 @@ pyyaml = [ {file = "PyYAML-5.4.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:bb4191dfc9306777bc594117aee052446b3fa88737cd13b7188d0e7aa8162185"}, {file = "PyYAML-5.4.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:6c78645d400265a062508ae399b60b8c167bf003db364ecb26dcab2bda048253"}, {file = "PyYAML-5.4.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:4e0583d24c881e14342eaf4ec5fbc97f934b999a6828693a99157fde912540cc"}, + {file = "PyYAML-5.4.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:72a01f726a9c7851ca9bfad6fd09ca4e090a023c00945ea05ba1638c09dc3347"}, + {file = "PyYAML-5.4.1-cp36-cp36m-manylinux2014_s390x.whl", hash = "sha256:895f61ef02e8fed38159bb70f7e100e00f471eae2bc838cd0f4ebb21e28f8541"}, {file = "PyYAML-5.4.1-cp36-cp36m-win32.whl", hash = "sha256:3bd0e463264cf257d1ffd2e40223b197271046d09dadf73a0fe82b9c1fc385a5"}, {file = "PyYAML-5.4.1-cp36-cp36m-win_amd64.whl", hash = "sha256:e4fac90784481d221a8e4b1162afa7c47ed953be40d31ab4629ae917510051df"}, {file = "PyYAML-5.4.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:5accb17103e43963b80e6f837831f38d314a0495500067cb25afab2e8d7a4018"}, {file = "PyYAML-5.4.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:e1d4970ea66be07ae37a3c2e48b5ec63f7ba6804bdddfdbd3cfd954d25a82e63"}, + {file = "PyYAML-5.4.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:cb333c16912324fd5f769fff6bc5de372e9e7a202247b48870bc251ed40239aa"}, + {file = "PyYAML-5.4.1-cp37-cp37m-manylinux2014_s390x.whl", hash = "sha256:fe69978f3f768926cfa37b867e3843918e012cf83f680806599ddce33c2c68b0"}, {file = "PyYAML-5.4.1-cp37-cp37m-win32.whl", hash = "sha256:dd5de0646207f053eb0d6c74ae45ba98c3395a571a2891858e87df7c9b9bd51b"}, {file = "PyYAML-5.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:08682f6b72c722394747bddaf0aa62277e02557c0fd1c42cb853016a38f8dedf"}, {file = "PyYAML-5.4.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:d2d9808ea7b4af864f35ea216be506ecec180628aced0704e34aca0b040ffe46"}, {file = "PyYAML-5.4.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:8c1be557ee92a20f184922c7b6424e8ab6691788e6d86137c5d93c1a6ec1b8fb"}, + {file = "PyYAML-5.4.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:fd7f6999a8070df521b6384004ef42833b9bd62cfee11a09bda1079b4b704247"}, + {file = "PyYAML-5.4.1-cp38-cp38-manylinux2014_s390x.whl", hash = "sha256:bfb51918d4ff3d77c1c856a9699f8492c612cde32fd3bcd344af9be34999bfdc"}, {file = "PyYAML-5.4.1-cp38-cp38-win32.whl", hash = "sha256:fa5ae20527d8e831e8230cbffd9f8fe952815b2b7dae6ffec25318803a7528fc"}, {file = "PyYAML-5.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:0f5f5786c0e09baddcd8b4b45f20a7b5d61a7e7e99846e3c799b05c7c53fa696"}, {file = "PyYAML-5.4.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:294db365efa064d00b8d1ef65d8ea2c3426ac366c0c4368d930bf1c5fb497f77"}, {file = "PyYAML-5.4.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:74c1485f7707cf707a7aef42ef6322b8f97921bd89be2ab6317fd782c2d53183"}, + {file = "PyYAML-5.4.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:d483ad4e639292c90170eb6f7783ad19490e7a8defb3e46f97dfe4bacae89122"}, + {file = "PyYAML-5.4.1-cp39-cp39-manylinux2014_s390x.whl", hash = "sha256:fdc842473cd33f45ff6bce46aea678a54e3d21f1b61a7750ce3c498eedfe25d6"}, {file = "PyYAML-5.4.1-cp39-cp39-win32.whl", hash = "sha256:49d4cdd9065b9b6e206d0595fee27a96b5dd22618e7520c33204a4a3239d5b10"}, {file = "PyYAML-5.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:c20cfa2d49991c8b4147af39859b167664f2ad4561704ee74c1de03318e898db"}, {file = "PyYAML-5.4.1.tar.gz", hash = "sha256:607774cbba28732bfa802b54baa7484215f530991055bb562efbed5b2f20a45e"}, diff --git a/pyproject.toml b/pyproject.toml index 61da42e..4498a9c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,6 @@ asyncmy = "*" mkdocs = "*" mkdocs-material = "*" mkdocs-git-revision-date-localized-plugin = "*" -mkdocs-markdownextradata-plugin = "*" [build-system] requires = ["poetry-core>=1.0.0"]