flask-mongoengine
flask-mongoengine copied to clipboard
Pagination: incorrect next_num value when no records are returned
Example:
def view_todos(page=1): paginated_todos = Todo.objects.paginate(page=page, per_page=10)
Assumption : Todo doesn't have any records in database
Result:
As page = 1, next_num=2 : https://github.com/MongoEngine/flask-mongoengine/blob/93bd9b9b8803ffae1ca9dd6435c2108c02a0403e/flask_mongoengine/pagination.py#L78
Hey, the issue is property next_num is just incrementing the page number without validating whether its property has_next is true or false. I would like to work on this issue. Can you please assign it to me so I can get started? Thank you!