openedx.core.djangoapps.course_apps package#
Subpackages#
Submodules#
openedx.core.djangoapps.course_apps.api module#
Python APIs for Course Apps.
- openedx.core.djangoapps.course_apps.api.is_course_app_enabled(course_key: CourseKey, app_id: str) bool#
Return if the app with the specified app_id is enabled for the specified course.
- Parameters:
course_key (CourseKey) – Course key for course
app_id (str) – The app id for a course app
- Returns:
True or False depending on if the course app is enabled or not.
- openedx.core.djangoapps.course_apps.api.set_course_app_enabled(course_key: CourseKey, app_id: str, enabled: bool, user: User) bool#
Enable/disable a course app.
- Parameters:
course_key (CourseKey) – ID of course to operate on
app_id (str) – The app ID of the app to enabled/disable
enabled (bool) – The enable/disable status to apply
user (User) – The user performing the operation.
- Returns:
The final enabled/disabled status of the app.
openedx.core.djangoapps.course_apps.apps module#
Pluggable app config for course apps.
- class openedx.core.djangoapps.course_apps.apps.CourseAppsConfig(app_name, app_module)#
Bases:
AppConfigConfiguration class for Course Apps.
- name = 'openedx.core.djangoapps.course_apps'#
- plugin_app = {'url_config': {'cms.djangoapp': {'namespace': 'course_apps_api', 'regex': '^api/course_apps/', 'relative_path': 'rest_api.urls'}}}#
- ready()#
Override this method in subclasses to run code when Django starts.
openedx.core.djangoapps.course_apps.handlers module#
Signal handlers for course apps.
- openedx.core.djangoapps.course_apps.handlers.initialize_course_app_status(sender: str, course_key: CourseKey, is_enabled: bool, **kwargs)#
Create a new CourseAppStatus object when a course app is accessed for the first time.
For existing courses CourseAppStatus object might not exist. This handler creates a new CourseAppStatus object in such cases.
- Parameters:
sender (str) – The sender is the app_id for the app being accessed for the first time.
course_key (CourseKey) – The key for the course run the app is associated with
is_enabled (bool) – The status of the course app
- openedx.core.djangoapps.course_apps.handlers.update_course_apps(sender, course_key, **kwargs)#
Whenever the course is published, update the status of course apps in the django models to match their status in the course.
openedx.core.djangoapps.course_apps.models module#
Models to store course apps data.
- class openedx.core.djangoapps.course_apps.models.CourseAppStatus(*args, **kwargs)#
Bases:
TimeStampedModelCourseAppStatus stores the enabled/disabled status for course apps.
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- app_id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- course_key#
DO NOT REUSE THIS CLASS. Provided for backwards compatibility only!
A placeholder class that provides a way to set the attribute on the model.
- created#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- enabled#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- classmethod get_all_app_status_data_for_course(course_key: CourseKey) Dict[str, bool]#
Get a dictionary containing the status of all apps linked to the course.
- Parameters:
course_key (CourseKey) – the course id for which app status is needed
- Returns:
A dictionary where the keys are app ids and the values are booleans indicating if the app with that id is enabled
- get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
- get_next_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=True, **kwargs)#
- get_previous_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=False, **kwargs)#
- get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
- history = <django.db.models.manager.HistoryManagerFromHistoricalQuerySet object>#
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- modified#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>#
- save_without_historical_record(*args, **kwargs)#
Save the model instance without creating a historical record.
Make sure you know what you’re doing before using this method.
- classmethod update_status_for_course_app(course_key: CourseKey, app_id: str, enabled: bool)#
Creates or updates a status entry for the specified app and course.
- Parameters:
course_key (CourseKey) – the course id for which the app status is to be set
app_id (str) – id for course app to update
enabled (bool) – enabled status to set for app
openedx.core.djangoapps.course_apps.plugins module#
Course Apps plugin base class and plugin manager.
- class openedx.core.djangoapps.course_apps.plugins.CourseApp#
Bases:
ABCAbstract base class for all course app plugins.
- app_id: str = ''#
- description: str = ''#
- documentation_links: Dict = {}#
- abstractmethod classmethod get_allowed_operations(course_key: CourseKey, user: User | None = None) Dict[str, bool]#
Returns a dictionary of available operations for this app.
Not all apps will support being configured, and some may support other operations via the UI. This will list, the minimum whether the app can be enabled/disabled and whether it can be configured.
- Parameters:
course_key (CourseKey) – The course key for a course.
user (User) – The user for which the operation is to be tested.
- Returns:
A dictionary that has keys like ‘enable’, ‘configure’ etc with values indicating whether those operations are allowed.
- abstractmethod classmethod is_available(course_key: CourseKey) bool#
Returns a boolean indicating this course app’s availability for a given course.
If an app is not available, it will not show up in the UI at all for that course, and it will not be possible to enable/disable/configure it.
- Parameters:
course_key (CourseKey) – Course key for course whose availability is being checked.
- Returns:
Availability status of app.
- Return type:
bool
- abstractmethod classmethod is_enabled(course_key: CourseKey) bool#
Return if this course app is enabled for the provided course.
- Parameters:
course_key (CourseKey) – The course key for the course you want to check the status of.
- Returns:
The status of the course app for the specified course.
- Return type:
bool
- name: str = ''#
- abstractmethod classmethod set_enabled(course_key: CourseKey, enabled: bool, user: User) bool#
Update the status of this app for the provided course and return the new status.
- Parameters:
course_key (CourseKey) – The course key for the course for which the app should be enabled.
enabled (bool) – The new status of the app.
user (User) – The user performing this operation.
- Returns:
The new status of the course app.
- Return type:
bool
openedx.core.djangoapps.course_apps.signals module#
Signals for course apps.
openedx.core.djangoapps.course_apps.tasks module#
This file contains celery tasks for course apps.
openedx.core.djangoapps.course_apps.toggles module#
Toggles for course apps.
- openedx.core.djangoapps.course_apps.toggles.COURSE_APPS_WAFFLE_NAMESPACE = 'course_apps'#
Namespace for use by course apps for creating availability toggles
- openedx.core.djangoapps.course_apps.toggles.exams_ida_enabled(course_key)#
Returns a boolean if exams ida view is enabled for a course.