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.3.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.3-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for ckanext_resource_pagination-0.2.3.tar.gz
Algorithm Hash digest
SHA256 0ccecaa4b5585163c4d0e344c43fe174740b8206180e48b41a4226155df26543
MD5 986fedf2380780b502c0ac53a432ce55
BLAKE2b-256 c2a20c6376ae299e4087f11ffe5f79a608e0b9556163bde7ccaceaf1b9f3facc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ckanext_resource_pagination-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8634423313e140cf82ea94dcbaff0879155e04e00aa30ed386ec1e0a4205886d
MD5 de8087b9910daa2b442acb1597dc7ab4
BLAKE2b-256 f93abb026a45f59b1b3ffcf47b2615ec94b6429eb194a57e3df1c2943df8de82

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