title: Flask Many Pagination on One Single Page using flask-paginate 0.4.5
body: <p><a href="https://i.stack.imgur.com/mV9A6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mV9A6.jpg" alt="enter image description here"></a>I want to render three paginations on one single page using flask-paginate.
  The problem is that the three paginations are "synchronized" in te sense that clicking 'Next Page' of one pagination affects the other pagination too.
  I have tried to use different page names for different pagination but there is still something missing.
  I haven't found NOTHING about the Multiple Pagination, please help me in solving this issue. 
  PLEASE TAKE A LOOK AT THE PICTURE ATTACHED TO BETTER UNDERSTAND.
  Please note that I have followed the Miguel Gringberg book in creating this application, but he considers just single paginations and not multiple. <a href="https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world" rel="nofollow noreferrer">https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world</a></p>
  
  <p>I have a page ''discover.html'' with 3 lists of paginated elements:</p>
  
  <pre><code>&lt;div class="discover-content"&gt;
  
          &lt;div class="contests-list"&gt;
              {% with projects=contests, pagination=contests_pagination, page='main.discover', fragment='#contests' %}
                  &lt;h2&gt;Most Recent Contests&lt;/h2&gt;
                  {% include '_contests.html' %}
              {% endwith %}
          &lt;/div&gt;
  
          &lt;div class="skills-list"&gt;
              {% with skills=skills, pagination=skills_pagination, page='main.discover', fragment='#skills' %}
                  &lt;h2&gt;Skills&lt;/h2&gt;
                  {% include '_skills.html' %}
              {% endwith %}
          &lt;/div&gt;
  
          &lt;div class="ideas-list"&gt;
              {% with projects=ideas, pagination=ideas_pagination, page='main.discover', fragment='#ideas' %}
                  &lt;h2&gt;Most Recent Ideas&lt;/h2&gt;
                  {% include '_ideas.html' %}
              {% endwith %}
          &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>Where each list is like the following ''_skills.html'':</p>
  
  <pre><code>{% import "_macros.html" as macros %}
  
  &lt;ul class="skills"&gt;
      {% for skill in skills %}
          {% if skill.name %}
          &lt;li class="skill"&gt;{{ skill.name }}&lt;/li&gt;
          {% endif %}
      {% endfor %}
  &lt;/ul&gt;
  
  {% if pagination %}
      &lt;div class="pagination"&gt;
          {{ macros.pagination_widget(pagination, page, fragment=fragment) }}
      &lt;/div&gt;
  {% endif %}
  </code></pre>
  
  <p>The file ''_macros.html'' works in this way:</p>
  
  <pre><code>{% macro pagination_widget(pagination, endpoint, fragment='') %}
  &lt;ul class="pagination"&gt;
      &lt;li{% if not pagination.has_prev %} class="disabled"{% endif %}&gt;
          &lt;a href="{% if pagination.has_prev %}{{ url_for(endpoint, page=pagination.prev_num, **kwargs) }}{{ fragment }}{% else %}#{% endif %}"&gt;
              &amp;laquo;
          &lt;/a&gt;
      &lt;/li&gt;
      {% for p in pagination.iter_pages() %}
          {% if p %}
              {% if p == pagination.page %}
              &lt;li class="active"&gt;
                  &lt;a href="{{ url_for(endpoint, page = p, **kwargs) }}{{ fragment }}"&gt;{{ p }}&lt;/a&gt;
              &lt;/li&gt;
              {% else %}
              &lt;li&gt;
                  &lt;a href="{{ url_for(endpoint, page = p, **kwargs) }}{{ fragment }}"&gt;{{ p }}&lt;/a&gt;
              &lt;/li&gt;
              {% endif %}
          {% else %}
          &lt;li class="disabled"&gt;&lt;a href="#"&gt;&amp;hellip;&lt;/a&gt;&lt;/li&gt;
          {% endif %}
      {% endfor %}
      &lt;li{% if not pagination.has_next %} class="disabled"{% endif %}&gt;
          &lt;a href="{% if pagination.has_next %}{{ url_for(endpoint, page=pagination.next_num, **kwargs) }}{{ fragment }}{% else %}#{% endif %}"&gt;
              &amp;raquo;
          &lt;/a&gt;
      &lt;/li&gt;
  &lt;/ul&gt;
  {% endmacro %}
  </code></pre>
  
  <p>The view associated to the page ''discover.html'' is the following:</p>
  
  <pre><code>@main.route('/discover', defaults={'page_c': 1, 'page_i': 1, 'page_s': 1}, methods=['GET', 'POST'])
  @main.route('/discover/page_c/&lt;int:page_c&gt;/page_i/&lt;int:page_i&gt;/page_s/&lt;int:page_s&gt;', methods=['GET', 'POST'])
  def discover(page_c, page_i, page_s):
  
      contests_page = request.args.get(page_c, 1, type=int)
      contests_pagination = Project.query.filter_by(project_type='contest').order_by(Project.timestamp.desc()).paginate(
          contests_page, per_page=current_app.config['CONTESTS_PER_PAGE'], error_out=False)
      contests = contests_pagination.items
  
      ideas_page = request.args.get(page_i, 1, type=int)
      ideas_pagination = Project.query.filter_by(project_type='idea').order_by(Project.timestamp.desc()).paginate(
          ideas_page, per_page=current_app.config['IDEAS_PER_PAGE'], error_out=False)
      ideas = ideas_pagination.items
  
      skills_page = request.args.get(page_s, 1, type=int)
      skills_pagination = Skill.query.order_by(Skill.name.desc()).paginate(
          skills_page, per_page=current_app.config['SKILLS_PER_PAGE'], error_out=False)
      skills = skills_pagination.items
  
  
      return render_template('discover.html', contests=contests, ideas=ideas, skills=skills,
                             contests_pagination=contests_pagination, ideas_pagination=ideas_pagination,
                             skills_pagination=skills_pagination)
  </code></pre>