Skip to main content

Paginate the resource list on CKAN dataset pages with configurable page sizes

Project description

ckanext-resource-pagination

A CKAN extension that adds pagination to the resource list on dataset pages.

CKAN renders every resource on a single page by default. For datasets with hundreds or thousands of resources, this crashes the browser and makes pages unusable. This plugin paginates the resource list with configurable page sizes and Bootstrap 5 navigation controls.

Features

  • Paginates the resource list on dataset detail pages (/dataset/<id>)
  • Configurable number of resources per page (default: 50)
  • Only processes visible resources (skips resource_view_list calls for off-page resources)
  • Bootstrap 5 pagination controls with windowed page numbers
  • "Showing X-Y of Z resources" counter
  • Works with all dataset types
  • No database changes or migrations required

Requirements

  • CKAN 2.11+
  • Python 3.8+

Installation

pip install ckanext-resource-pagination

Add resource_pagination to ckan.plugins in your ckan.ini:

ckan.plugins = ... resource_pagination

Restart CKAN.

Configuration

Setting Default Description
ckanext.resource_pagination.per_page 50 Number of resources to show per page

Example:

ckanext.resource_pagination.per_page = 25

How it works

The plugin registers a Flask blueprint via IBlueprint that intercepts the dataset read route (/dataset/<id>). The view:

  1. Calls package_show to fetch the dataset (standard CKAN behavior)
  2. Reads the resource_page query parameter from the URL
  3. Slices the resources list to the configured page size
  4. Only calls resource_view_list on visible resources
  5. Passes pagination metadata to the template

The plugin also overrides package/read.html and package/snippets/resources_list.html to render the sliced resource list with pagination controls.

License

AGPL-3.0

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

ckanext_resource_pagination-0.2.2.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ckanext_resource_pagination-0.2.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file ckanext_resource_pagination-0.2.2.tar.gz.

File metadata

File hashes

Hashes for ckanext_resource_pagination-0.2.2.tar.gz
Algorithm Hash digest
SHA256 72d20cdf8347386b48e9e156ac359b8cf1384353315cf827f9dc93a8b7f343e7
MD5 82923d435dd5094af958906c61d641c1
BLAKE2b-256 5e506c1e6f6cd5313c48347fb113525a48c821786234f0a54801863901d79064

See more details on using hashes here.

File details

Details for the file ckanext_resource_pagination-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for ckanext_resource_pagination-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 65aa08524ffc80d074ccee34da91c19108e74fd21d4a7cc05795d767e7303768
MD5 359f838cb41d391d6a3456041b7b31a2
BLAKE2b-256 7bb06c81c723ad0a6efb41ba75ac75b704bbfcedbdd60d63d7557d4c05f7bfd0

See more details on using hashes here.

Supported by

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