Skip to content

Commit

Permalink
Update application.py
Browse files Browse the repository at this point in the history
  • Loading branch information
aminalaee authored May 6, 2024
1 parent 324e995 commit 748d317
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sqladmin/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,14 @@ async def list(self, request: Request) -> Response:
pagination = await model_view.list(request)
pagination.add_pagination_urls(request.url)

if (
pagination.page * pagination.page_size
> pagination.count + pagination.page_size
):
raise HTTPException(
status_code=400, detail="Invalid page or pageSize parameter"
)

context = {"model_view": model_view, "pagination": pagination}
return await self.templates.TemplateResponse(
request, model_view.list_template, context
Expand Down

0 comments on commit 748d317

Please sign in to comment.