openedx.core.djangoapps.discussions package#
Subpackages#
Submodules#
openedx.core.djangoapps.discussions.apps module#
Configure the django app
- class openedx.core.djangoapps.discussions.apps.DiscussionsConfig(app_name, app_module)#
Bases:
AppConfigConfigure the discussions django app
- name = 'openedx.core.djangoapps.discussions'#
- plugin_app = {'settings_config': {}, 'url_config': {'cms.djangoapp': {'namespace': '', 'regex': '^api/discussions/', 'relative_path': 'urls'}, 'lms.djangoapp': {'app_name': 'openedx.core.djangoapps.discussions', 'namespace': '', 'regex': '^discussions/api/', 'relative_path': 'urls'}}}#
- ready()#
Override this method in subclasses to run code when Django starts.
openedx.core.djangoapps.discussions.handlers module#
Signal handlers for discussions events
- openedx.core.djangoapps.discussions.handlers.handle_course_discussion_config_update(sender, configuration: CourseDiscussionConfigurationData, **kwargs)#
Updates the database models for course topics and configuration when settings are updated in the course.
- Parameters:
sender – Ignored
configuration (CourseDiscussionConfigurationData) – configuration data for the course
- openedx.core.djangoapps.discussions.handlers.update_course_discussion_config(configuration: CourseDiscussionConfigurationData)#
Update the database version of the configuration if it changes in the course structure.
This function accepts a discussion configuration object that represents the current configuration and applies that state to the database. It will go over the list of topic links in the configuration, find the corresponding topic link in the database and apply any changes if needed. If a new topic link has been introduced it will create an entry. If a topic has been removed, it will deactivate the entry.
When this runs on a new course it will create a new DiscussionConfiguration entry for the course.
- Parameters:
configuration (CourseDiscussionConfigurationData) – configuration data for the course
openedx.core.djangoapps.discussions.models module#
Provide django models to back the discussions app
- class openedx.core.djangoapps.discussions.models.DiscussionTopicLink(*args, **kwargs)#
Bases:
ModelA model linking discussion topics ids to the part of a course they are linked to.
..no_pii:
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- context#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- context_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.
- enabled_in_context#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- external_id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- group#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- group_id#
- id#
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>#
- ordering#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- provider_id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- title#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- usage_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.
- class openedx.core.djangoapps.discussions.models.DiscussionsConfiguration(*args, **kwargs)#
Bases:
TimeStampedModelAssociates a learning context with discussion provider and configuration
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- property available_providers: List[str]#
- clean()#
Validate the model. Currently, this only support courses, this can be extended whenever discussions are available in other contexts
- context_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.
- enable_graded_units#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- enable_in_context#
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(context_key: CourseKey) T#
Lookup a model by context_key
- classmethod get_available_providers(context_key: CourseKey) List[str]#
- 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_posting_restrictions_display(*, field=<django.db.models.fields.CharField: posting_restrictions>)#
- 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>#
- classmethod is_enabled(context_key: CourseKey) bool#
Check if there is an active configuration for a given course key
Default to False, if no configuration exists
- lti_configuration#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- lti_configuration_id#
- classmethod lti_discussion_enabled(course_key: CourseKey) bool#
Checks if LTI discussion is enabled for this course.
- Parameters:
course_key – course locator.
- Returns:
Boolean indicating weather or not this course has lti discussion enabled.
- 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>#
- plugin_configuration#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- posting_restrictions#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- provider_type#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- 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.
- supports(feature: str) bool#
Check if the provider supports some feature
- supports_in_context_discussions()#
Returns is the provider supports in-context discussions
- supports_lti() bool#
Returns a boolean indicating if the provider supports lti discussion view.
- unit_level_visibility#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class openedx.core.djangoapps.discussions.models.Features(*values)#
Bases:
EnumFeatures to be used/mapped in discussion providers
- ANONYMOUS_POSTING = 'anonymous-posting'#
- AUTOMATIC_LEARNER_ENROLLMENT = 'automatic-learner-enrollment'#
- BASIC_CONFIGURATION = 'basic-configuration'#
- BLACKOUT_DISCUSSION_DATES = 'blackout-discussion-dates'#
- COMMUNITY_TA_SUPPORT = 'community-ta-support'#
- COURSE_COHORT_SUPPORT = 'course-cohort-support'#
- DIRECT_MESSAGES_FROM_INSTRUCTORS = 'direct-messages-from-instructors'#
- DISCUSSION_CONTENT_PROMPTS = 'discussion-content-prompts'#
- EMAIL_NOTIFICATIONS = 'email-notifications'#
- GRADED_DISCUSSIONS = 'graded-discussions'#
- INTERNATIONALIZATION_SUPPORT = 'internationalization-support'#
- IN_PLATFORM_NOTIFICATIONS = 'in-platform-notifications'#
- LTI_ADVANCED_SHARING_MODE = 'lti-advanced-sharing-mode'#
- PRIMARY_DISCUSSION_APP_EXPERIENCE = 'primary-discussion-app-experience'#
- QUESTION_DISCUSSION_SUPPORT = 'question-discussion-support'#
- REPORT_FLAG_CONTENT_TO_MODERATORS = 'report/flag-content-to-moderators'#
- RESEARCH_DATA_EVENTS = 'research-data-events'#
- USER_MENTIONS = 'user-mentions'#
- WCAG_2_0_SUPPORT = 'wcag-2.0-support'#
- property support#
- property value#
- class openedx.core.djangoapps.discussions.models.PostingRestriction(*values)#
Bases:
TextChoicesDiscussions Restrictions choices
- DISABLED = 'disabled'#
- ENABLED = 'enabled'#
- SCHEDULED = 'scheduled'#
- class openedx.core.djangoapps.discussions.models.Provider#
Bases:
objectList of Discussion providers.
- ED_DISCUSS = 'ed-discuss'#
- INSCRIBE = 'inscribe'#
- LEGACY = 'legacy'#
- OPEN_EDX = 'openedx'#
- PIAZZA = 'piazza'#
- YELLOWDIG = 'yellowdig'#
- class openedx.core.djangoapps.discussions.models.ProviderExternalLinks(learn_more, configuration, general, accessibility, contact_email)#
Bases:
tuple- accessibility#
Alias for field number 3
- configuration#
Alias for field number 1
- contact_email#
Alias for field number 4
- general#
Alias for field number 2
- learn_more#
Alias for field number 0
- class openedx.core.djangoapps.discussions.models.ProviderFilter(*args, **kwargs)#
Bases:
StackedConfigurationModelAssociate allow/deny-lists of discussions providers with courses/orgs
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- STACKABLE_FIELDS = ('enabled', 'allow', 'deny')#
- allow#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property available_providers: List[str]#
Return a filtered list of available providers
- change_date#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- changed_by#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- changed_by_id#
- course#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- course_id#
- deny#
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_available_providers(course_key: CourseKey) List[str]#
- get_next_by_change_date(*, field=<django.db.models.fields.DateTimeField: change_date>, is_next=True, **kwargs)#
- get_previous_by_change_date(*, field=<django.db.models.fields.DateTimeField: change_date>, is_next=False, **kwargs)#
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- org#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- org_course#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- site#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- site_id#
- openedx.core.djangoapps.discussions.models.get_default_provider_type() str#
Returns the default provider type to use for new courses. :returns: (str) default provider type to use
- openedx.core.djangoapps.discussions.models.get_supported_providers() List[str]#
Return the list of supported discussion providers
TODO: Load this from entry points?
- openedx.core.djangoapps.discussions.models.pii_sharing_required_message(provider_name)#
Build an i18n’ed message stating PII sharing is required for the provider.
openedx.core.djangoapps.discussions.permissions module#
API library for Django REST Framework permissions-oriented workflows
- class openedx.core.djangoapps.discussions.permissions.HasPagesAndResourcesAccess#
Bases:
BasePermissionCheck if user has access to Pages & Resources.
When the authz feature flag is enabled, uses authz permissions. GET requests check view permission, all others check manage permission. Falls back to has_discussion_privileges when authz denies access (transitional until discussion roles are migrated to authz). When the flag is off, falls back to legacy behavior: global staff, course instructor, course staff, or discussion privileges.
- has_permission(request, view)#
Return True if permission is granted, False otherwise.
- openedx.core.djangoapps.discussions.permissions.check_course_permissions(course, user, permission)#
Check the user has permissions for the operation over the course configuration.
Raises PermissionDenied if the user does not have permission
- openedx.core.djangoapps.discussions.permissions.user_permissions_for_course(course, user)#
Return the user’s permissions over the discussion configuration of the course.
openedx.core.djangoapps.discussions.plugins module#
Course app configuration for discussions.
- class openedx.core.djangoapps.discussions.plugins.DiscussionCourseApp#
Bases:
CourseAppCourse App config for Discussions.
- app_id: str = 'discussion'#
- description: str = 'Encourage participation and engagement in your course with discussions.'#
- documentation_links: Dict = {'learn_more_configuration': 'https://docs.openedx.org/en/latest/educators/concepts/communication/about_course_discussions.html'}#
- classmethod get_allowed_operations(course_key: CourseKey, user: User | None = None) Dict[str, bool]#
Return allowed operations for discussions app.
- classmethod is_available(course_key: CourseKey) bool#
Discussions is always available.
- classmethod is_enabled(course_key: CourseKey) bool#
Discussions enable/disable status is stored in a separate model.
- name: str = 'Discussion'#
openedx.core.djangoapps.discussions.serializers module#
Serializers for Discussion views.
- class openedx.core.djangoapps.discussions.serializers.DiscussionSettingsSerializer(*args, **kwargs)#
Bases:
SerializerSerializer for course discussion settings.
- create(validated_data)#
This method intentionally left empty
- to_internal_value(data: dict) dict#
Transform the incoming primitive data into a native value.
- to_representation(instance: CourseDiscussionSettings) dict#
Return a serialized representation of the course discussion settings.
- update(instance: CourseDiscussionSettings, validated_data: dict) CourseDiscussionSettings#
Update and save an existing instance
- class openedx.core.djangoapps.discussions.serializers.DiscussionsConfigurationSerializer(*args, **kwargs)#
Bases:
ModelSerializerSerialize configuration responses
- class Meta#
Bases:
object- course_fields = ['provider_type', 'enable_in_context', 'enable_graded_units', 'unit_level_visibility', 'posting_restrictions']#
- fields = ['enabled', 'provider_type', 'enable_in_context', 'enable_graded_units', 'unit_level_visibility', 'posting_restrictions']#
- model#
alias of
DiscussionsConfiguration
- create(validated_data)#
We do not need this.
- to_internal_value(data: dict) dict#
Transform the incoming primitive data into a native value.
- to_representation(instance: DiscussionsConfiguration) dict#
Serialize data into a dictionary, to be used as a response
- update(instance: DiscussionsConfiguration, validated_data: dict) DiscussionsConfiguration#
Update and save an existing instance
- class openedx.core.djangoapps.discussions.serializers.DiscussionsFeatureSerializer(*args, **kwargs)#
Bases:
SerializerSerializer for discussions features
- class openedx.core.djangoapps.discussions.serializers.DiscussionsProviderSerializer(*args, **kwargs)#
Bases:
SerializerSerializer for a discussion provider
- class openedx.core.djangoapps.discussions.serializers.DiscussionsProvidersSerializer(*args, **kwargs)#
Bases:
SerializerSerializer for discussion providers.
- class openedx.core.djangoapps.discussions.serializers.LegacySettingsSerializer(*args, **kwargs)#
Bases:
BaseSerializerSerialize legacy discussions settings
- class Meta#
Bases:
object- fields = ['allow_anonymous', 'allow_anonymous_to_peers', 'discussion_blackouts', 'discussion_topics']#
- fields_cohorts = ['always_divide_inline_discussions', 'divided_course_wide_discussions', 'divided_inline_discussions', 'division_scheme', 'reported_content_email_notifications']#
- create(validated_data)#
We do not need this.
- to_internal_value(data: dict) dict#
Transform the incoming primitive data into a native value
- to_representation(instance) dict#
Serialize data into a dictionary, to be used as a response
- update(instance, validated_data: dict)#
Update and save an existing instance
- class openedx.core.djangoapps.discussions.serializers.LtiSerializer(*args, **kwargs)#
Bases:
ModelSerializerSerialize LtiConfiguration responses
- class Meta#
Bases:
object- fields = ['pii_share_username', 'pii_share_email', 'lti_1p1_client_key', 'lti_1p1_client_secret', 'lti_1p1_launch_url', 'version']#
- model#
alias of
LtiConfiguration
- to_internal_value(data: dict) dict#
Transform the incoming primitive data into a native value
- update(instance: LtiConfiguration, validated_data: dict) LtiConfiguration#
Create/update a model-backed instance
openedx.core.djangoapps.discussions.services module#
Discussion Configuration Service for XBlock runtime.
This service provides discussion-related configuration and feature flags that are specific to the edx-platform implementation for the extracted discussion block in xblocks-contrib repository.
- class openedx.core.djangoapps.discussions.services.DiscussionConfigService#
Bases:
objectService for providing discussion-related configuration and feature flags.
- has_permission(user: User, permission: str, course_id: CourseKey | None = None) bool#
Return whether the user has the given discussion permission for a given course.
- is_discussion_enabled() bool#
Return True if discussions are enabled; else False
- is_discussion_visible(course_key: CourseKey) bool#
Discussion Xblock does not support new OPEN_EDX provider
openedx.core.djangoapps.discussions.tasks module#
Tasks for discussions
- openedx.core.djangoapps.discussions.tasks.get_discussable_units(course, enable_graded_units, discussable_units=None)#
Get all the units in the course that are discussable.
- openedx.core.djangoapps.discussions.tasks.get_sections(course)#
Get sections for given course
- openedx.core.djangoapps.discussions.tasks.get_subsections(section)#
Get subsections for given section
- openedx.core.djangoapps.discussions.tasks.get_units(subsection)#
Get units for given subsection
- openedx.core.djangoapps.discussions.tasks.is_discussable_unit(unit, store, enable_graded_units, subsection)#
Check if unit should have discussion’s topic
- openedx.core.djangoapps.discussions.tasks.update_discussions_settings_from_course(course_key: CourseKey, discussable_units=None) CourseDiscussionConfigurationData#
When there are changes to a course, construct a new data structure containing all the context needed to update the course’s discussion settings in the database.
- Parameters:
course_key (CourseKey) – The course that was recently updated.
discussable_units (List[UsageKey]) – list of discussable units
- Returns:
structured discussion configuration data.
- Return type:
(CourseDiscussionConfigurationData)
- openedx.core.djangoapps.discussions.tasks.update_unit_discussion_state_from_discussion_blocks(course_key: CourseKey, user_id: int, force=False, async_topics=True) None#
Migrate existing courses to the new mechanism for linking discussion to units.
This will iterate over an existing course’s discussion xblocks and mark the units they are in as discussable.
- Parameters:
course_key (CourseKey) – CourseKey for course.
user_id (int) – User id for the user performing this operation.
force (bool) – Force migration of data even if not using legacy provider
async_topics (bool) – If True, run the task asynchronously.
openedx.core.djangoapps.discussions.transformers module#
Discussions Topic Link Transformer
- class openedx.core.djangoapps.discussions.transformers.DiscussionsTopicLinkTransformer#
Bases:
BlockStructureTransformerA transformer that adds discussion topic context to the xblock.
- EMBED_URL = 'discussions_url'#
- EXTERNAL_ID = 'discussions_id'#
- READ_VERSION = 1#
- WRITE_VERSION = 1#
- classmethod name()#
Unique identifier for the transformer’s class. This must match the entry point name in the package configuration.
- transform(usage_info, block_structure)#
loads override data into blocks
openedx.core.djangoapps.discussions.url_helpers module#
Helps for building discussions URLs
- openedx.core.djangoapps.discussions.url_helpers.get_discussions_mfe_topic_url(course_key: CourseKey, topic_id: str, view: str | None = None) str#
Returns the url for discussions for the specified course and topic in the discussions MFE.
- Parameters:
course_key (CourseKey) – course key of course for which to get url
topic_id (str) – topic id for topic to get url for
view (str) – which view to generate url for
- Returns:
(str) URL link for MFE. Empty if the base url isn’t configured
- openedx.core.djangoapps.discussions.url_helpers.get_discussions_mfe_url(course_key: CourseKey, view: str | None = None) str#
Returns the url for discussions for the specified course in the discussions MFE.
- Parameters:
course_key (CourseKey) – course key of course for which to get url
view (str) – which view to generate url for
- Returns:
(str) URL link for MFE. Empty if the base url isn’t configured
openedx.core.djangoapps.discussions.urls module#
Configure URL endpoints for the djangoapp
openedx.core.djangoapps.discussions.utils module#
Shared utility code related to discussions.
- openedx.core.djangoapps.discussions.utils.available_division_schemes(course_key: CourseKey) List[str]#
Returns a list of possible discussion division schemes for this course. This takes into account if cohorts are enabled and if there are multiple enrollment tracks. If no schemes are available, returns an empty list. :param course_key: CourseKey
Returns: list of possible division schemes (for example, CourseDiscussionSettings.COHORT)
- openedx.core.djangoapps.discussions.utils.enrollment_track_group_count(course_key: CourseKey) int#
Returns the count of possible enrollment track division schemes for this course. :param course_key: CourseKey
- Returns:
Count of enrollment track division scheme
- openedx.core.djangoapps.discussions.utils.get_accessible_discussion_xblocks(course: CourseBlock, user: User | None, include_all: bool = False) List[DiscussionXBlock]#
Return a list of all valid discussion xblocks in this course that are accessible to the given user.
- openedx.core.djangoapps.discussions.utils.get_accessible_discussion_xblocks_by_course_id(course_id: CourseKey, user: User | None = None, include_all: bool = False) List[DiscussionXBlock]#
Return a list of all valid discussion xblocks in this course. Checks for the given user’s access if include_all is False.
- openedx.core.djangoapps.discussions.utils.get_course_division_scheme(course_discussion_settings: CourseDiscussionSettings) str#
Returns the division scheme used by the course, from the course discussion settings. :param course_discussion_settings: An instance of the CourseDiscussionSettings model :type course_discussion_settings: CourseDiscussionSettings
- Returns:
- (string) Returns ‘cohort’, ‘enrollment_track’ or ‘none’
depending on the division scheme used by the course.
- openedx.core.djangoapps.discussions.utils.get_discussion_categories_ids(course: CourseBlock, user: User | None, include_all: bool = False) List[str]#
Returns a list of available ids of categories for the course that are accessible to the given user.
- Parameters:
course – Course for which to get the ids.
user – User to check for access.
include_all – Whether categories from all blocks should be included.
- openedx.core.djangoapps.discussions.utils.get_divided_discussions(course: CourseBlock, discussion_settings: CourseDiscussionSettings) Tuple[List[str], List[str]]#
Returns the course-wide and inline divided discussion ids separately.
- openedx.core.djangoapps.discussions.utils.get_group_names_by_id(course_discussion_settings: CourseDiscussionSettings) Dict[str, str]#
Creates of a dict of group_id to learner-facing group names, for the division_scheme in use as specified by course_discussion_settings. :param course_discussion_settings: CourseDiscussionSettings model instance
Returns: dict of group_id to learner-facing group names. If no division_scheme is in use, returns an empty dict.
- openedx.core.djangoapps.discussions.utils.has_required_keys(xblock: DiscussionXBlock)#
Returns True iff xblock has the proper attributes for generating metadata with get_discussion_id_map_entry()
openedx.core.djangoapps.discussions.views module#
Handle view-logic for the discussions app.
- class openedx.core.djangoapps.discussions.views.CombinedDiscussionsConfigurationView(**kwargs)#
Bases:
DiscussionsConfigurationSettingsViewCombined view that includes both provider data and discussion configuration.
Note
This is temporary code for backwards-compatibility and will be removed soon after the frontend supports the new split APIs.
- get(request: Request, course_key_string: str, **_kwargs) Response#
Handle HTTP/GET requests
- post(request, course_key_string: str, **_kwargs) Response#
Handle HTTP/POST requests
- class openedx.core.djangoapps.discussions.views.DiscussionsConfigurationSettingsView(**kwargs)#
Bases:
APIViewView for configuring discussion settings.
- authentication_classes = (<class 'edx_rest_framework_extensions.auth.jwt.authentication.JwtAuthentication'>, <class 'openedx.core.lib.api.authentication.BearerAuthenticationAllowInactiveUser'>, <class 'edx_rest_framework_extensions.auth.session.authentication.SessionAuthenticationAllowInactiveUser'>)#
- get(request: Request, course_key_string: str, **_kwargs) Response#
Handle HTTP/GET requests
- static get_configuration_data(request: Request, course_key_string: str) Dict#
Get discussions configuration data for the course :param request: a DRF request :type request: Request :param course_key_string: a course key string :type course_key_string: str
- Returns:
Discussion configuration data for the course
- Return type:
Dict
- permission_classes = (<class 'openedx.core.djangoapps.discussions.permissions.HasPagesAndResourcesAccess'>,)#
- post(request, course_key_string: str, **_kwargs) Response#
Handle HTTP/POST requests
- static update_configuration_data(request, course_key_string)#
Update discussion configuration for the course based on data in the request. :param request: a DRF request :type request: Request :param course_key_string: a course key string :type course_key_string: str
- Returns:
modified course configuration data
- Return type:
Dict
- class openedx.core.djangoapps.discussions.views.DiscussionsProvidersView(**kwargs)#
Bases:
APIViewRead only view that lists details of discussion providers available for a course.
- authentication_classes = (<class 'edx_rest_framework_extensions.auth.jwt.authentication.JwtAuthentication'>, <class 'openedx.core.lib.api.authentication.BearerAuthenticationAllowInactiveUser'>, <class 'edx_rest_framework_extensions.auth.session.authentication.SessionAuthenticationAllowInactiveUser'>)#
- get(request, course_key_string: str, **_kwargs) Response#
Handle HTTP/GET requests
- static get_provider_data(course_key_string: str, show_all: bool = False) Dict#
Get provider data for specified course :param course_key_string: course key string :type course_key_string: str :param show_all: don’t hide any providers :type show_all: bool
- Returns:
course discussion providers
- Return type:
Dict
- permission_classes = (<class 'openedx.core.djangoapps.discussions.permissions.HasPagesAndResourcesAccess'>,)#
- class openedx.core.djangoapps.discussions.views.SyncDiscussionTopicsView(**kwargs)#
Bases:
APIViewView for syncing discussion topics for a course.
- authentication_classes = (<class 'openedx.core.lib.api.authentication.BearerAuthenticationAllowInactiveUser'>, <class 'edx_rest_framework_extensions.auth.session.authentication.SessionAuthenticationAllowInactiveUser'>)#
- permission_classes = (<class 'rest_framework.permissions.IsAuthenticated'>, <class 'openedx.core.djangoapps.discussions.permissions.HasPagesAndResourcesAccess'>)#
- post(request, course_key_string)#
Sync discussion topics for the course based on data in the request.
- Parameters:
request (Request) – a DRF request
course_key_string (str) – a course key string
- Returns:
modified course configuration data
- Return type:
Response
Module contents#
Handle discussions integrations