{"id":23084,"library":"edx-when","title":"edx-when","description":"A Django app for managing content scheduling and due dates in Open edX courses. It provides models and APIs for content dates, user-specific overrides, and schedule computation. Current version 4.0.0 (released 2025-05-07). Release cadence: irregular, with major version bumps when dropping Python/Django support.","status":"active","version":"4.0.0","language":"python","source_language":"en","source_url":"https://github.com/openedx/edx-when","tags":["edx","openedx","django","scheduling","due-dates"],"install":[{"cmd":"pip install edx-when","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Models and migrations depend on Django ORM","package":"Django","optional":false},{"reason":"UsageKey types for block identifiers","package":"edx-opaque-keys","optional":false}],"imports":[{"note":"UserDate is a different model; ContentDate stores site-wide date ranges","wrong":"from edx_when.models import UserDate","symbol":"ContentDate","correct":"from edx_when.models import ContentDate"},{"note":"models_schedule does not exist in this library","wrong":"from edx_when.models_schedule import UserDate","symbol":"UserDate","correct":"from edx_when.models import UserDate"},{"note":"API function must be imported from edx_when.api","wrong":"from edx_when import get_schedule_for_user","symbol":"get_schedule_for_user","correct":"from edx_when.api import get_schedule_for_user"}],"quickstart":{"code":"import os\nos.environ.setdefault('DJANGO_SETTINGS_MODULE', 'yourproject.settings')\n\nimport django\ndjango.setup()\n\nfrom django.contrib.auth import get_user_model\nfrom opaque_keys.edx.keys import CourseKey\nfrom edx_when.api import get_schedule_for_user\n\ndef demo():\n    user = get_user_model().objects.first()\n    course_key = CourseKey.from_string('course-v1:DemoX+Demo_2024')\n    schedule = get_schedule_for_user(user.id, course_key)\n    print(schedule[:3] if schedule else 'No schedule found')\n\ndemo()","lang":"python","description":"Fetches the first 3 schedule entries for a given user and course. Requires Django settings configured."},"warnings":[{"fix":"Upgrade to Python 3.12+ or pin to edx-when<4.0.0.","message":"Version 4.0.0 drops support for Python 3.11. You must use Python 3.12+. Check your deployment.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Upgrade to Python 3.9+ or use edx-when<3.0.0.","message":"Version 3.0.0 drops support for Python 3.8 and adds Python 3.12 support. Existing Python 3.8 deployments will break.","severity":"breaking","affected_versions":">=3.0.0,<4.0.0"},{"fix":"Use user.id and course_key. Convert course strings with CourseKey.from_string().","message":"The get_schedule_for_user function requires a User ID (integer) and CourseKey; passing a username or course string will raise an AttributeError.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run: pip install edx-when","cause":"Library not installed or missing from requirements.","error":"ModuleNotFoundError: No module named 'edx_when'"},{"fix":"Use: from edx_when.api import get_schedule_for_user","cause":"Incorrect import path. The api module is a submodule, not a top-level attribute.","error":"AttributeError: module 'edx_when' has no attribute 'api'"},{"fix":"Call django.setup() after configuring DJANGO_SETTINGS_MODULE.","cause":"Using edx-when outside Django without calling django.setup() first.","error":"django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}