mirror of
https://github.com/d3vyce/fastapi-toolsets.git
synced 2026-03-02 01:10:47 +01:00
Add examples in documentations (#99)
* docs: fix crud * docs: update README features * docs: add pagination/search example * docs: update zensical.toml * docs: cleanup * docs: update status to Stable + update description * docs: add example run commands
This commit is contained in:
19
docs_src/examples/pagination_search/crud.py
Normal file
19
docs_src/examples/pagination_search/crud.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from fastapi_toolsets.crud import CrudFactory
|
||||
|
||||
from .models import Article, Category
|
||||
|
||||
ArticleCrud = CrudFactory(
|
||||
model=Article,
|
||||
cursor_column=Article.created_at,
|
||||
searchable_fields=[ # default fields for full-text search
|
||||
Article.title,
|
||||
Article.body,
|
||||
(Article.category, Category.name),
|
||||
],
|
||||
facet_fields=[ # fields exposed as filter dropdowns
|
||||
Article.status,
|
||||
(Article.category, Category.name),
|
||||
],
|
||||
)
|
||||
|
||||
ArticleFilters = ArticleCrud.filter_params()
|
||||
Reference in New Issue
Block a user