{"action":"opened","issue":{"url":"https://api.github.com/repos/pallets/flask/issues/1952","repository_url":"https://api.github.com/repos/pallets/flask","labels_url":"https://api.github.com/repos/pallets/flask/issues/1952/labels{/name}","comments_url":"https://api.github.com/repos/pallets/flask/issues/1952/comments","events_url":"https://api.github.com/repos/pallets/flask/issues/1952/events","html_url":"https://github.com/pallets/flask/issues/1952","id":164907001,"number":1952,"title":"Flask-paginate shows all results on same page","user":{"login":"dsingh-uh","id":10697022,"avatar_url":"https://avatars.githubusercontent.com/u/10697022?v=3","gravatar_id":"","url":"https://api.github.com/users/dsingh-uh","html_url":"https://github.com/dsingh-uh","followers_url":"https://api.github.com/users/dsingh-uh/followers","following_url":"https://api.github.com/users/dsingh-uh/following{/other_user}","gists_url":"https://api.github.com/users/dsingh-uh/gists{/gist_id}","starred_url":"https://api.github.com/users/dsingh-uh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsingh-uh/subscriptions","organizations_url":"https://api.github.com/users/dsingh-uh/orgs","repos_url":"https://api.github.com/users/dsingh-uh/repos","events_url":"https://api.github.com/users/dsingh-uh/events{/privacy}","received_events_url":"https://api.github.com/users/dsingh-uh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-11T18:48:30Z","updated_at":"2016-07-11T18:48:30Z","closed_at":null,"body":"I am using Flask-paginate for pagination in my app. The results are fetched from database. The problem is that all results show up on 1st page and when I click on the next page number again all results are displayed on that page. The page number in url changes to 2/3/4 etc. I [this][1] as reference. Here is my code snippet\r\n\r\n\r\n  [1]: https://pythonhosted.org/Flask-paginate/\r\n```\r\nfrom flask.ext.paginate import Pagination\r\n    @app.route('/users')\r\n    def users_page():\r\n    \r\n        page_size = 25\r\n        limit = 100\r\n    \r\n        search = False\r\n        q = request.args.get('q')\r\n        if q:\r\n            search = True\r\n        try:\r\n            page = int(request.args.get('page', 1))\r\n        except ValueError:\r\n            page = 1\r\n        with session_scope() as session:\r\n            users = users_dao.get_users(session, limit=limit)\r\n            pagination = Pagination(page=page, total=len(users), per_page=page_size, search=search, record_name='users')\r\n            return render_template(\"users.html\", users=users, pagination=pagination)\r\n```\r\nThe pagination info on html page says `displaying 1-25 results of 100`. When clicked on page 2, it says `displaying 25-50 results of 100`. So somehow the pagination has figured out on the basis of total and per_page how many results should be displayed but somewhere it fails to force that on number of rows to show. Any idea how to not to show all rows on every page?\r\n\r\n\r\nThe template looks like \r\n\r\n  ```\r\n{{ pagination.info }}\r\n    <table class=\"table\">\r\n        <thead>\r\n            <tr>\r\n                <th>User Name</th>\r\n                <th>Phone</th>\r\n                <th>City</th>\r\n                <th>Country</th>\r\n            </tr>\r\n        </thead>\r\n        <tbody>\r\n            {% for user in users %}\r\n            <tr>\r\n                <td>{{ user.user_name }}</td>\r\n                <td>{{ user.phone_number }}</td>\r\n                <td>{{user.city}}</td>\r\n                <td>{{user.country}}</td>\r\n            </tr>\r\n            {% endfor %}\r\n        </tbody>\r\n    </table>\r\n    {{ pagination.links }}\r\n```\r\n"}}
{"actor":{"display_login":"dsingh-uh"}}