No project description provided
Project description
ckanext-likes
A CKAN extension that enables users to like any object with a unique ID, promoting engagement across datasets, resources, organizations, and more.
Overview
This CKAN extension introduces a flexible and reusable "like" functionality that can be attached to any CKAN object with a unique identifier. Whether it's datasets, resources, organizations, groups, or custom entities introduced by other extensions, this plugin allows users to express appreciation or endorse content directly within the CKAN interface.
Key features include:
-
Universal Compatibility: Works with any CKAN object that has a unique ID, including datasets, resources, organizations, users, or even custom content types.
-
ful API Support: Exposes endpoints to like/unlike objects and retrieve like counts, enabling integration with third-party systems or frontend customizations.
-
Customizable UI Widgets: Provides simple templates and frontend snippets that can be embedded anywhere in CKAN themes to display like buttons and counters.
-
User Tracking & Anti-Spam: Ties likes to user accounts to prevent duplicate voting and support analytics.
This extension can be a powerful tool to highlight popular datasets, promote community curation, and enhance overall user interaction on your CKAN portal.
Installation
Compatibility with core CKAN versions:
| CKAN version | Compatible? |
|---|---|
| <= 2.10 | No |
| >= 2.11 | Yes |
Install the extension from PyPI:
pip install ckanext-likes
Add likes to the list of CKAN plugins and apply database migrations:
ckan db upgrade -p likes
Usage
Add like-widget on any page and it will automatically initialize and update likes for the specified object:
{%
snippet "likes/snippets/widget.html",
object_id=OBJECT_ID, object_type=OBJECT_TYPE, inline=true
%}
inline flag renders widget with 0 likes. When the widget appears in the
viewport for the first time, it updates the value via AJAX request and listens
for the user clicks, handling like/un-like events and re-rendering icon and
counter.
If you want to update counters as soon as page loads, add
inline_trigger="load" argument to the snippet call. This is not recommended
if you have a lot of widgets on the page, such as like-buttons agains every
comment in the comments thread.
{%
snippet "likes/snippets/widget.html",
object_id=OBJECT_ID, object_type=OBJECT_TYPE, inline=true, inline_trigger="load"
%}
If you already know the number of likes for the object and whether current
visitor has already liked the object, specify these parameters as count and
liked arguments for the snippet, instead of the inline=true. In this case,
widget won't perform additional requests to the backend during initialization:
{%
snippet "likes/snippets/widget.html",
object_id=OBJECT_ID, object_type=OBJECT_TYPE, count=100, liked=true
%}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ckanext_likes-0.0.1.tar.gz.
File metadata
- Download URL: ckanext_likes-0.0.1.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27fb98336692b98ac9de4496c78a821308b7ec188bd959dad7cb8b8da781fab4
|
|
| MD5 |
4cbee166edc464beaccebbd1694a6046
|
|
| BLAKE2b-256 |
479d42f64f2955c2d182cc832dd8d29b66d35bb03b2ee8b609903c9945064aee
|
File details
Details for the file ckanext_likes-0.0.1-py3-none-any.whl.
File metadata
- Download URL: ckanext_likes-0.0.1-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bc190e5d5cb89bb01aa260af2f021495887daf3d4a5eb966fffcd61f27cb739
|
|
| MD5 |
cbdeab8385b93674959e1cf981d907ad
|
|
| BLAKE2b-256 |
7160f570a97da934459e299735015c0fb3480d53a375b5b2c2bafe16c1a91dfc
|