edx-completion
raw JSON → 5.0.0 verified Fri May 01 auth: no python
A Django app for tracking completion of blocks by learners in edX courses. Current version 5.0.0. Release cadence is irregular, with frequent dependency upgrades and occasional feature drops.
pip install edx-completion Common errors
error ModuleNotFoundError: No module named 'completion' ↓
cause Package not installed or import path wrong.
fix
Run
pip install edx-completion and use from completion.models import BlockCompletion. error TypeError: submit_completion() missing 1 required positional argument: 'block_key' ↓
cause Missing argument when calling submit_completion.
fix
Ensure you provide all required arguments: user_id, course_key, block_key, completion.
error django.core.exceptions.ImproperlyConfigured: The app 'completion' is not a properly configured Django application. ↓
cause The Django app is not added to INSTALLED_APPS.
fix
Add 'completion' to INSTALLED_APPS in settings.
Warnings
gotcha The `submit_completion` function expects `course_key` and `block_key` as strings (serialized opaque keys), not objects. Using `CourseKey` or `BlockUsageLocator` objects will raise a TypeError. ↓
fix Ensure keys are stringified via `str(course_key)` before calling submit_completion.
breaking In v5.0.0, support for Python 3.8 was dropped. If your project uses Python 3.8, you must upgrade. ↓
fix Use Python 3.10 or later.
deprecated The `get_completions` function in `completion.api` was deprecated in v4.x and removed in v5.0.0. Use `BlockCompletion.objects.filter(...)` instead. ↓
fix Replace `get_completions(...)` with `BlockCompletion.objects.filter(...)`.
Imports
- BlockCompletion wrong
from completion import BlockCompletioncorrectfrom completion.models import BlockCompletion - submit_completion wrong
from completion import submit_completioncorrectfrom completion.api import submit_completion
Quickstart
from completion.api import submit_completion
from completion.models import BlockCompletion
# Submit a completion for a block
block_key = 'block-v1:Org+Course+Run+type@problem+block@abc123'
user_id = 1
course_key = 'course-v1:Org+Course+Run'
submit_completion(
user_id=user_id,
course_key=course_key,
block_key=block_key,
completion=1.0
)
# Query existing completions
completions = BlockCompletion.objects.filter(user_id=user_id, course_key=course_key)
print(list(completions))