Results pagination
Fixes
Fixes microtask T399974
Description
This feature will implement pagination of results.
By default, the results per page are now limited to 10.
The user can navigate to other pages using the Previous and Next navigation buttons.
There is also a <span> displaying the current number of results on the page and the number of results in total.
The use of parameters was essential so that users could share the link containing the results with others.
Type of PR
This PR is a feature
Checklist
-
Create a limitquery parameter to limit the number of results -
Create a pagequery parameter to paginate results -
Use a formula limited_search_result = search_result[start:end]to display results by 10. This formula will skip the previous 10 results or the next 10 results, accordingly -
Return all variables inside the render_template()method fromapp.pyto use in theresults.htmlfile -
Create a pagination <div>that contains Previous and Next navigation buttons, the Current Page number and information about the Number of results.
Screen recordings
| Before pagination | After pagination |
|---|---|
To take it further
- Create a
<select>dropdown with options to change the number of results displayed per page. - Add pages button (
<a>tags) and/or<input>field to allow users to navigate to a specific page.