Use str type for pk path param. (#52)

This commit is contained in:
long2ice
2021-06-04 17:54:02 +08:00
parent 42c7351914
commit 70d2a7a529
3 changed files with 8 additions and 4 deletions

View File

@@ -2,6 +2,10 @@
## 1.0
### 1.0.2
- Use `str` type for `pk` path param. (#52)
### 1.0.1
- Add `column_attributes`.

View File

@@ -79,7 +79,7 @@ async def list_view(
async def update(
request: Request,
resource: str = Path(...),
pk: int = Path(...),
pk: str = Path(...),
model_resource: ModelResource = Depends(get_model_resource),
resources=Depends(get_resources),
model=Depends(get_model),
@@ -136,7 +136,7 @@ async def update(
async def update_view(
request: Request,
resource: str = Path(...),
pk: int = Path(...),
pk: str = Path(...),
model_resource: ModelResource = Depends(get_model_resource),
resources=Depends(get_resources),
model=Depends(get_model),
@@ -237,7 +237,7 @@ async def create(
@router.delete("/{resource}/delete/{pk}")
async def delete(request: Request, pk: int, model: Model = Depends(get_model)):
async def delete(request: Request, pk: str, model: Model = Depends(get_model)):
await model.filter(pk=pk).delete()
return RedirectResponse(url=request.headers.get("referer"), status_code=HTTP_303_SEE_OTHER)

View File

@@ -18,7 +18,7 @@ packages = [
]
readme = "README.md"
repository = "https://github.com/fastapi-admin/fastapi-admin.git"
version = "1.0.1"
version = "1.0.2"
[tool.poetry.dependencies]
Babel = "*"