redirectory.libs_int.database.database_pagination module

class redirectory.libs_int.database.database_pagination.Page(items, page, page_size, total)[source]

Bases: object

redirectory.libs_int.database.database_pagination.paginate(query, page: int, page_size: int) → redirectory.libs_int.database.database_pagination.Page[source]

Creates a query with the help of limit() and offset() to represent a page. Also counts the total number of items in the given database.

Parameters:
  • query – the query which specifies the model tha paginate
  • page (int) – the page number
  • page_size (int) – how many items per page
Returns:

a Page object with all the items inside