Skip to main content

e3-django-learning-materials

PyPI version License: MIT Python versions

A bilingual (French/English) learning materials CMS for Django. Create, organize, translate, publish, and serve articles, videos, and PDFs with role-based targeting.

Installation

pip install e3-django-learning-materials

Quick Start

1. Add to INSTALLED_APPS

# settings.py
INSTALLED_APPS = [
    ...
    "rest_framework",
    "e3_learning_materials",
]

2. Include URLs

# urls.py
from django.urls import include, path

urlpatterns = [
    ...
    path("learning-materials/", include("e3_learning_materials.urls")),
    path("api/learning-materials/", include("e3_learning_materials.api_urls")),
]

3. Run migrations

python manage.py migrate e3_learning_materials

4. Visit /learning-materials/

Start creating and managing learning materials.

Templates

The package ships with a built-in base template (e3_learning_materials/base.html) so it works out of the box — no need to provide your own base.html.

To use your project's base template instead, set BASE_TEMPLATE in your settings:

E3_LEARNING_MATERIALS = {
    'BASE_TEMPLATE': 'my_project/base.html',
}

The only requirement is that your base template defines these Django blocks:

  • {% block content %} — main content area (required)
  • {% block extracss %} — extra stylesheets (optional)
  • {% block javascript %} — extra scripts, must include {{ block.super }} for jQuery/DataTables (optional)

Configuration

All settings go in an E3_LEARNING_MATERIALS dict in your Django settings:

E3_LEARNING_MATERIALS = {
    # Template extended by all learning-materials templates.
    # Default: "e3_learning_materials/base.html"
    "BASE_TEMPLATE": "myapp/base.html",

    # Dotted path to a permission-check function.
    # The function receives the request and returns True/False.
    # Example: "myapp.utils.is_admin"
    # If None (default), any authenticated user can access.
    "PERMISSION_CALLBACK": "myapp.utils.is_admin",

    # Directory prefix for file uploads under MEDIA_ROOT.
    # Default: "learning_materials"
    "UPLOAD_PATH_PREFIX": "my_uploads",

    # URL namespace used by the package.
    # Default: "e3_learning_materials"
    "URL_NAMESPACE": "e3_learning_materials",
}

Features

Content Model

Field Type Description
title_fr / title_en CharField Bilingual titles
summary_fr / summary_en TextField Bilingual summaries
body_fr / body_en TextField Bilingual body content
category ChoiceField Getting Started, Filing a Grievance, Your Rights, Triage & Processing, Escalation, Reporting Duties, FAQ
content_type ChoiceField Article, Video, PDF
target_roles JSONField Citizen, Facilitator, Village Secretary
languages JSONField French, English
status ChoiceField Draft, Published, Archived
read_time CharField Estimated reading time
file FileField PDF, JPG, PNG, MP4 upload

Web UI URLs

URL View Name
/learning-materials/ List + KPIs home
/learning-materials/data/ AJAX DataTable data data
/learning-materials/create/ Create form create
/learning-materials/<pk>/ Redirect to update detail
/learning-materials/<pk>/update/ Update form update
/learning-materials/<pk>/delete/ Delete confirmation delete

Use with {% url 'e3_learning_materials:home' %} (or your configured URL_NAMESPACE).

REST API

Method URL Auth Description
GET /api/learning-materials/ None List published materials (filtered by audience)
GET /api/learning-materials/<id>/ Token Retrieve a single material

Audience filtering:

GET /api/learning-materials/?audience=facilitator
GET /api/learning-materials/?audience=citizen
GET /api/learning-materials/?audience=both

Admin Integration

The LearningMaterial model is registered with Django admin with list display, filtering by category/content_type/status, and search.

Permissions

By default, any authenticated user can access learning materials. Set PERMISSION_CALLBACK to restrict access:

# myapp/utils.py
def is_admin(request):
    return request.user.is_staff

The callback receives the request object and must return True (grant access) or False (return 403).

Requirements

  • Django >= 4.1
  • Django REST Framework >= 3.14
  • Python >= 3.10

Development

pip install -e ".[dev]"
pytest tests/ -v

Publishing

See PUBLISH.md for instructions on publishing to PyPI.

Changelog

See CHANGELOG.md for release history.

License

MIT

Metadata

Release files for e3-django-learning-materials 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for e3-django-learning-materials 0.3.0
File Size Uploaded Provenance Actions
e3_django_learning_materials-0.3.0.tar.gz 22.4 kB Without provenance Details for e3_django_learning_materials-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for e3-django-learning-materials 0.3.0
File Interpreter ABI Platform Actions
e3_django_learning_materials-0.3.0-py3-none-any.whl Python 3 none any Details for e3_django_learning_materials-0.3.0-py3-none-any.whl

Total release size: 51.5 kB

Release files / e3_django_learning_materials-0.3.0.tar.gz

Download URL e3_django_learning_materials-0.3.0.tar.gz
Size 22.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d52ad8167fc2f154a652534077ef226177a8d08092d8988e70a4cbe80120820f
BLAKE2b-256 checksum
How to use checksums
78a9a6393700c11725c39d9f69a7cb28cc9f7ebcc2d27bd33325c544da458da0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / e3_django_learning_materials-0.3.0-py3-none-any.whl

Download URL e3_django_learning_materials-0.3.0-py3-none-any.whl
Size 29.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac03bb49e6096941d42a21d5e7abd0dd6718d5f63b7c20854779c0545257ae3c
BLAKE2b-256 checksum
How to use checksums
284b556e9fb80069b3a79522b594ddfb8a214b4fd0df6ad4e375dd39c90846fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for e3-django-learning-materials 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page