You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
size: int= Query(20, ge=1, le=1000, description="Number of records per page"),
@@ -210,7 +210,7 @@ class CustomPagination(Pagination[ModelType]):
210
210
pages: int=0
211
211
212
212
@classmethod
213
-
deffrom_query(
213
+
defbuild(
214
214
cls,
215
215
page: int= Query(1, ge=1, description="Page number to retrieve"),
216
216
size: int= Query(10, ge=1, le=50, description="Number of records per page"),
@@ -231,6 +231,6 @@ class CustomPagination(Pagination[ModelType]):
231
231
232
232
**Explanation**
233
233
234
-
-`from_query`: Defines how query parameters are parsed into the pagination instance. In this example, it uses page and size with constraints (e.g., size capped at 50).
234
+
-`build`: Defines how query parameters are parsed into the pagination instance. In this example, it uses page and size with constraints (e.g., size capped at 50).
235
235
-`paginate`: Applies the pagination logic to the queryset, calculating the offset based on the page and size, then limiting the results.
236
236
-`fill_meta`: Computes metadata like the total item count and number of pages, ensuring accurate pagination information in the response.
0 commit comments