|
|
@ -11,7 +11,10 @@ from tildes.models.pagination import PaginatedQuery, PaginatedResults |
|
|
|
|
|
|
|
|
|
|
|
def query_apply_pagination( # noqa |
|
|
|
query, before, after, error_if_no_anchor: bool = False |
|
|
|
query: PaginatedQuery, |
|
|
|
before: str | None, |
|
|
|
after: str | None, |
|
|
|
error_if_no_anchor: bool = False, |
|
|
|
) -> PaginatedQuery: |
|
|
|
"""Apply pagination parameters to a query.""" |
|
|
|
# Start by parsing the before/after parameters and extracting the anchor type |
|
|
@ -46,7 +49,9 @@ def query_apply_pagination( # noqa |
|
|
|
return query |
|
|
|
|
|
|
|
|
|
|
|
def get_next_and_prev_link(request: Request, page: PaginatedResults) -> Tuple[str, str]: |
|
|
|
def get_next_and_prev_link( |
|
|
|
request: Request, page: PaginatedResults |
|
|
|
) -> Tuple[str | None, str | None]: |
|
|
|
"""Get the next and previous links for pagination.""" |
|
|
|
next_link = None |
|
|
|
prev_link = None |
|
|
|