Skip to content

refactor(course_modes): resolve default mode slug at runtime instead …#80

Closed
andrey-canon wants to merge 1 commit into
open-release/teak.nelpfrom
and/refactor-dynamic-course-mode-default
Closed

refactor(course_modes): resolve default mode slug at runtime instead …#80
andrey-canon wants to merge 1 commit into
open-release/teak.nelpfrom
and/refactor-dynamic-course-mode-default

Conversation

@andrey-canon

Copy link
Copy Markdown
Collaborator

Description

Currently, the default course enrollment mode slug is evaluated and frozen at import time during server startup via the static class attribute CourseMode.DEFAULT_MODE_SLUG = settings.COURSE_MODE_DEFAULTS['slug'].

This implementation restricts flexibility if the active Django settings context changes or needs to be evaluated dynamically beyond the initial boot sequence.

This PR refactors the class to remove the static DEFAULT_MODE_SLUG constant and updates all internal references to use the get_default_mode_slug() class method instead. The method now directly fetches settings.COURSE_MODE_DEFAULTS['slug'] on invocation, effectively shifting the configuration evaluation from import-time to runtime.

…of import time

Replaced the static class attribute `DEFAULT_MODE_SLUG` with a dynamic
evaluation inside `get_default_mode_slug()`. This ensures that
`settings.COURSE_MODE_DEFAULTS` is inspected at runtime rather than
being frozen during server initialization, increasing configuration
flexibility.
@andrey-canon andrey-canon temporarily deployed to open-release/teak.nelp June 26, 2026 20:59 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant