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.1.tar.gz (5.4 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.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for ckanext_resource_pagination-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8b7f935b6c97da0f3fff41dba8a8399d516f57836360073050da51c49622eac4
MD5 9785de0310f038d1423ff727c3dbf210
BLAKE2b-256 e2005771924301c6aefc8df7ab479f407abaac2b8d8429bf8ed75cca9b399067

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ckanext_resource_pagination-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cac25770b2c725db4a649478290103d721211c6568b6f0a078b3237dff1e1e94
MD5 56b5db20c68198435c860faa9f232f0d
BLAKE2b-256 58c24dd4501c5885f6a556f92dda27bcc496802bf03ebe4a8799ee5e84fdb43e

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