Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 6 additions & 39 deletions lx_pathway_plugin/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,9 @@
"""
lx_pathway_plugin Django application initialization.
"""
from django.apps import AppConfig
from openedx.core.djangoapps.plugins.constants import PluginSettings, PluginURLs, ProjectType, SettingsType


class LxPathwayPluginAppConfig(AppConfig):
"""
Configuration for the lx_pathway_plugin Django plugin application.

See: https://github.com/edx/edx-platform/blob/master/openedx/core/djangoapps/plugins/README.rst
"""

name = 'lx_pathway_plugin'
plugin_app = {
PluginURLs.CONFIG: {
ProjectType.CMS: {
# The namespace to provide to django's urls.include.
PluginURLs.NAMESPACE: 'lx_pathway_plugin',
},
ProjectType.LMS: {
# The namespace to provide to django's urls.include.
PluginURLs.NAMESPACE: 'lx_pathway_plugin',
# use a different set of URLs/views in the LMS
PluginURLs.RELATIVE_PATH: 'urls_lms',
},
},
PluginSettings.CONFIG: {
ProjectType.CMS: {
SettingsType.PRODUCTION: {PluginSettings.RELATIVE_PATH: 'settings'},
},
ProjectType.LMS: {
SettingsType.PRODUCTION: {PluginSettings.RELATIVE_PATH: 'settings'},
},
},
}

def ready(self):
"""
Load signal handlers when the app is ready.
"""
try:
# Use the Open edX app config if we can
from .openedx_apps import LxPathwayPluginAppConfig
except ModuleNotFoundError:
# Otherwise, fall back to the LabXchange app config
from .lx_apps import LxPathwayPluginAppConfig
14 changes: 14 additions & 0 deletions lx_pathway_plugin/lx_apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
Django application initialization for use inside the LabXchange application.

Here, the lx_pathway_plugin is just a normal app, not a Django plugin.
"""
from django.apps import AppConfig


class LxPathwayPluginAppConfig(AppConfig):
"""
Configuration for the lx_pathway_plugin Django application.
"""

name = 'lx_pathway_plugin'
43 changes: 43 additions & 0 deletions lx_pathway_plugin/openedx_apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
"""
lx_pathway_plugin Django application initialization.
"""
from django.apps import AppConfig
from openedx.core.djangoapps.plugins.constants import PluginSettings, PluginURLs, ProjectType, SettingsType


class LxPathwayPluginAppConfig(AppConfig):
"""
Configuration for the lx_pathway_plugin Django plugin application.

See: https://github.com/edx/edx-platform/blob/master/openedx/core/djangoapps/plugins/README.rst
"""

name = 'lx_pathway_plugin'
plugin_app = {
PluginURLs.CONFIG: {
ProjectType.CMS: {
# The namespace to provide to django's urls.include.
PluginURLs.NAMESPACE: 'lx_pathway_plugin',
},
ProjectType.LMS: {
# The namespace to provide to django's urls.include.
PluginURLs.NAMESPACE: 'lx_pathway_plugin',
# use a different set of URLs/views in the LMS
PluginURLs.RELATIVE_PATH: 'urls_lms',
},
},
PluginSettings.CONFIG: {
ProjectType.CMS: {
SettingsType.PRODUCTION: {PluginSettings.RELATIVE_PATH: 'settings'},
},
ProjectType.LMS: {
SettingsType.PRODUCTION: {PluginSettings.RELATIVE_PATH: 'settings'},
},
},
}

def ready(self):
"""
Load signal handlers when the app is ready.
"""
9 changes: 7 additions & 2 deletions lx_pathway_plugin/pathway_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@

from edx_django_utils.cache.utils import RequestCache
from opaque_keys.edx.keys import UsageKey
from openedx.core.djangoapps.xblock.learning_context import LearningContext
from openedx.core.djangoapps.xblock.learning_context.manager import get_learning_context_impl

try:
from openedx.core.djangoapps.xblock.learning_context import LearningContext
from openedx.core.djangoapps.xblock.learning_context.manager import get_learning_context_impl
except ModuleNotFoundError:
from labxchange.apps.blocks.learning_context import LearningContext, get_learning_context_impl


from lx_pathway_plugin.keys import PathwayLocator, PathwayUsageLocator
from lx_pathway_plugin.models import Pathway
Expand Down