Skip to main content

KISS approach to a "Load more" style AJAX paginator.

Project description

KISS approach to a “Load more” style AJAX paginator


  • Django 1.3+

  • jQuery


  • Non-intrusive: your Django view is completely unaware of dynamic load-more stuff going on.

  • There is literally no code (no Python, no Javascript) required to get a fully AJAX style “load more” going.

  • KISS


  • Write your view as usual, handing over an (unpaginated) list of items to a template.

  • Render the list of items in your template as follows:

    {% load pagemore %}
    {% more_paginator items per_page=10 ordered_by="-created_at" as paginator %}
    {% for item in paginator.objects %}
    {% if forloop.first %}
    <div class="pagemore-container">
    {% endif %}
    {% if forloop.last %}
    {% if paginator.has_more %}
    <a class="pagemore-paginator" href="?{{paginator.next_query}}">More items...</a>
    {% endif %}
    {% endif %}
    {% endfor %}
    <script type="text/javascript" src="{{STATIC_URL}}pagemore/js/pagemore.js"></script>
    <script type="text/javascript">
        $(function() { $(".pagemore-paginator").pagemore(); });
  • That’s all!

Pagination Strategies

When a user is paginating through a list of items, while at the same time new items are being inserted, offset based slicing would result in duplicate items being shown. A way to circumvent this is to make sure that the items are properly ordered and to filter on items after a certain point. Both strategies are supported.

Paginate by Slicing


{% more_paginator ... strategy="slice" ... %}


  • Supports both querysets and lists

  • Does not order the objects unless explicitly told to (ordered_by).

Paginate by Filtering


{% more_paginator ... strategy="filter" ... %}


  • Only supports querysets

  • Enforces an ordering of the objects passed (default on id, overridable by ordered_by).

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-pagemore-0.2.0.tar.gz (6.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page