django-pagemore
KISS approach to a “Load more” style AJAX paginator
Requirements
Django 1.3+
jQuery
Features
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
Quickstart
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 %} {{item}} {% if forloop.last %} </div> {% 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(); }); </script>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
Usage:
{% more_paginator ... strategy="slice" ... %}
Characteristics:
Supports both querysets and lists
Does not order the objects unless explicitly told to (ordered_by).
Paginate by Filtering
Usage:
{% more_paginator ... strategy="filter" ... %}
Characteristics:
Only supports querysets
Enforces an ordering of the objects passed (default on id, overridable by ordered_by).
Metadata
Release files for django-pagemore 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-pagemore-0.2.0.tar.gz | 6.3 kB | Without provenance | Details for django-pagemore-0.2.0.tar.gz |
Release files / django-pagemore-0.2.0.tar.gz
| Download URL | django-pagemore-0.2.0.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3debbefdc0781d2c1c470de39b6144d347ed4948c6d3b6bdcd5bac84f8705dcb
|
|
BLAKE2b-256 checksum How to use checksums |
341096f0121c0b520193c10646448d8e50c76a597e957ce58ee82fe3c0c11561
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-pagemore 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.