Skip to main content

Django plugin for Open edX to manage POK certificates

Project description

openedx-pok

Introduction

This repository contains a plugin for Open edX that replaces the standard certificate generation system with a custom integration using the POK API. The main goal is to enable the issuance of personalized and advanced certificates, managed via the POK API, while maintaining interoperability with the Open edX ecosystem.

The plugin uses Open edX-provided filters to intercept events related to certificate creation and rendering, redirecting these processes to the POK API. This allows for a seamless and transparent integration for end users.

Architecture and Operation

### 1. Event Interception Using Filters

The plugin leverages Open edX filters to intercept the following key events:

  • CertificateCreationRequested: This filter is triggered when a certificate creation request is made. The plugin redirects this request to the POK API to generate the certificate.

  • CertificateRenderStarted: This filter is triggered when a certificate is about to be rendered. The plugin redirects the rendering process to the POK API to display the generated certificate or an intermediate status (e.g., processing, error).

### 2. Integration with the POK API

The POK API client (PokApiClient) handles all communication with the external API. This includes:

  • Requesting custom certificates.

  • Retrieving details of existing certificates.

  • Generating previews of certificate templates.

  • Managing custom parameters defined in POK templates.

### 3. Database Models

The plugin defines two main models:

  • PokCertificate: Stores information about certificates generated via POK, including status, viewing URL, and additional metadata.

  • CertificateTemplate: Links an Open edX course to a specific POK template, enabling per-course certificate customization.

### 4. Administration and Configuration

The plugin includes a Django admin interface to manage certificates and templates. Additionally, plugin settings are defined in settings.common.py, where parameters such as the POK API URL, authentication keys, and timeout values are configured.

Workflow

  1. Certificate Creation: - When a certificate is requested, the CertificateCreationRequested filter intercepts the request. - The POK API client is used to send user, course, and custom parameter data. - The POK API generates the certificate and returns a unique identifier, which is stored in the PokCertificate model.

  2. Certificate Rendering: - When a user attempts to view a certificate, the CertificateRenderStarted filter intercepts the request. - Depending on the certificate status (issued, in progress, etc.), the plugin redirects the user to the appropriate URL or displays an intermediate status page.

  3. Error Handling: - If an error occurs during certificate generation or rendering, the plugin displays a custom error page.

Configuration

### Prerequisites

  • A working Open edX installation.

  • Valid credentials for accessing the POK API.

  • Certificate templates configured in the POK platform.

### Configuration Variables

The following variables must be set in the settings.common.py file:

  • POK_API_URL: Base URL of the POK API.

  • POK_API_KEY: Authentication key for the API.

  • POK_TEMPLATE_ID: Default template ID.

  • POK_TIMEOUT: Timeout value for API requests.

### Installation

  1. Clone this repository into the Open edX extensions directory.

  2. Add openedx_pok to the INSTALLED_APPS list in the Django settings.

  3. Configure the required variables in the Open edX settings file.

  4. Run migrations to create the required database tables:

python manage.py migrate openedx_pok

### Usage

  • Admin Panel: Use the Django admin interface to manage certificates and templates.

  • Preview: Use the preview functionality to check how a certificate will appear before issuing it.

  • Monitoring: Check logs to debug issues or monitor the status of POK API requests.

Support

This Open edX plugin was developed by Aulasneo. Feel free to reach out to us if you need a custom version of it. Also, If you encounter issues or have questions, you can open an issue in this repository or join discussions in the Open edX community.

https://aulasneo.com/

License

This project is licensed under the terms specified in the LICENSE.txt file.

Contributions

Contributions are welcome. Please read the contribution guidelines before submitting a pull request.

Change Log

1.0.3 - 2025-12-05

Changed

  • Do not allow multiple templates for the same course.

  • Improve testing and code quality.

1.0.2 - 2025-11-06

Changed

  • Enhanced language tag resolution with user preferences and normalization.

1.0.1 - 2025-11-05

Changed

  • Added support for language tag resolution based on user profile, HTTP Accept-Language, and thread language.

0.2.0 - 2025-06-03

Added

  • Documentation: Detailed technical README explaining how the plugin integrates with POK API using Open edX filters.

  • Support: Initial Django admin support for managing templates and generated certificates.

  • Integration: PokApiClient for managing communication with POK (creation, rendering, preview, etc.).

  • Filters: Hooked into CertificateCreationRequested and CertificateRenderStarted to override default behavior.

  • Models: Added PokCertificate and CertificateTemplate for linking and tracking external certificate generation.

  • Configuration: Introduced environment-based settings for API credentials and timeouts.

Changed

  • Refactored certificate generation logic to fully delegate to POK API.

  • Improved error handling for API failures and rendering issues.

Fixed

  • Corrected integration points with Open edX to ensure compatibility with Django 4.2 and plugin architecture.

0.1.0 – 2025-03-26

Added

  • First release on PyPI.

  • Initial implementation of POK integration plugin for Open edX.

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

openedx_pok-1.0.3.tar.gz (32.3 kB view details)

Uploaded Source

Built Distribution

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

openedx_pok-1.0.3-py2.py3-none-any.whl (36.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file openedx_pok-1.0.3.tar.gz.

File metadata

  • Download URL: openedx_pok-1.0.3.tar.gz
  • Upload date:
  • Size: 32.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for openedx_pok-1.0.3.tar.gz
Algorithm Hash digest
SHA256 d5faa143e6dfa6dc394a9832c3a49529d4997686006cf5fb4e48540e86d4aef5
MD5 859625073bc2995ca06b6a9fb7ade3a9
BLAKE2b-256 e1f0d6c306c06c958c0f1b6a0070a856afe61575b2b58cf160d8135d0147e3fe

See more details on using hashes here.

File details

Details for the file openedx_pok-1.0.3-py2.py3-none-any.whl.

File metadata

  • Download URL: openedx_pok-1.0.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 36.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for openedx_pok-1.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 30e3a4020cb8cb49ff3687faa80118a54e75a6c1dc63d1543dba7f9d1443130c
MD5 2093c62283924bb7b88e1336dd4f26ed
BLAKE2b-256 3554188c9aa1ba2230da32ffda1eddf9655aae012b83c18bcb14e53fc0a3308e

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