From d853444229f903ade95b55af2527141813cafbf9 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Wed, 4 Mar 2020 10:43:18 -0500 Subject: [PATCH 1/2] Schedules is a core part of the LMS, install it by default, rather than through the plugins mechanism --- cms/envs/common.py | 3 +++ lms/envs/common.py | 3 +++ openedx/core/djangoapps/schedules/apps.py | 17 ----------------- openedx/core/djangoapps/schedules/signals.py | 2 ++ setup.py | 1 - 5 files changed, 8 insertions(+), 18 deletions(-) diff --git a/cms/envs/common.py b/cms/envs/common.py index 696fee419b..33dc18a8d7 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -1428,6 +1428,9 @@ INSTALLED_APPS = [ # signal handlers to capture course dates into edx-when 'openedx.core.djangoapps.course_date_signals', + + # Management of per-user schedules + 'openedx.core.djangoapps.schedules', ] diff --git a/lms/envs/common.py b/lms/envs/common.py index 936caa43dc..48f3d8b34b 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -2477,6 +2477,9 @@ INSTALLED_APPS = [ # Management of external user ids 'openedx.core.djangoapps.external_user_ids', + + # Management of per-user schedules + 'openedx.core.djangoapps.schedules', ] ######################### CSRF ######################################### diff --git a/openedx/core/djangoapps/schedules/apps.py b/openedx/core/djangoapps/schedules/apps.py index cfbbc53edc..510a28f352 100644 --- a/openedx/core/djangoapps/schedules/apps.py +++ b/openedx/core/djangoapps/schedules/apps.py @@ -10,23 +10,6 @@ class SchedulesConfig(AppConfig): name = 'openedx.core.djangoapps.schedules' verbose_name = _('Schedules') - plugin_app = { - PluginSignals.CONFIG: { - ProjectType.LMS: { - PluginSignals.RECEIVERS: [{ - PluginSignals.RECEIVER_FUNC_NAME: u'update_schedules_on_course_start_changed', - PluginSignals.SIGNAL_PATH: u'openedx.core.djangoapps.content.course_overviews.signals.COURSE_START_DATE_CHANGED', # pylint: disable=line-too-long - }] - }, - ProjectType.CMS: { - PluginSignals.RECEIVERS: [{ - PluginSignals.RECEIVER_FUNC_NAME: u'update_schedules_on_course_start_changed', - PluginSignals.SIGNAL_PATH: u'openedx.core.djangoapps.content.course_overviews.signals.COURSE_START_DATE_CHANGED', # pylint: disable=line-too-long - }] - }, - }, - } - def ready(self): # noinspection PyUnresolvedReferences from . import signals, tasks # pylint: disable=unused-variable diff --git a/openedx/core/djangoapps/schedules/signals.py b/openedx/core/djangoapps/schedules/signals.py index 39c371f110..3bfbed629d 100644 --- a/openedx/core/djangoapps/schedules/signals.py +++ b/openedx/core/djangoapps/schedules/signals.py @@ -17,6 +17,7 @@ from lms.djangoapps.courseware.models import ( DynamicUpgradeDeadlineConfiguration, OrgDynamicUpgradeDeadlineConfiguration ) +from openedx.core.djangoapps.content.course_overviews.signals import COURSE_START_DATE_CHANGED from openedx.core.djangoapps.schedules.content_highlights import course_has_highlights from openedx.core.djangoapps.schedules.models import ScheduleExperience from openedx.core.djangoapps.theming.helpers import get_current_site @@ -58,6 +59,7 @@ def create_schedule(sender, **kwargs): # pylint: disable=unused-argument )) +@receiver(COURSE_START_DATE_CHANGED) def update_schedules_on_course_start_changed(sender, updated_course_overview, previous_start_date, **kwargs): # pylint: disable=unused-argument """ Updates all course schedules start and upgrade_deadline dates based off of diff --git a/setup.py b/setup.py index a4d19b20b4..b87c71102d 100644 --- a/setup.py +++ b/setup.py @@ -76,7 +76,6 @@ setup( "discussion = lms.djangoapps.discussion.apps:DiscussionConfig", "grades = lms.djangoapps.grades.apps:GradesConfig", "plugins = openedx.core.djangoapps.plugins.apps:PluginsConfig", - "schedules = openedx.core.djangoapps.schedules.apps:SchedulesConfig", "theming = openedx.core.djangoapps.theming.apps:ThemingConfig", "bookmarks = openedx.core.djangoapps.bookmarks.apps:BookmarksConfig", "zendesk_proxy = openedx.core.djangoapps.zendesk_proxy.apps:ZendeskProxyConfig", From a8ba43133fb6244fdf449cebe5bbc40abf5c2a0a Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Wed, 4 Mar 2020 11:27:07 -0500 Subject: [PATCH 2/2] Remove schedules plugin from cms.djangoapps listing --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index b87c71102d..50f3640e67 100644 --- a/setup.py +++ b/setup.py @@ -97,7 +97,6 @@ setup( "discussion = lms.djangoapps.discussion.apps:DiscussionConfig", "olx_rest_api = openedx.core.djangoapps.olx_rest_api.apps:OlxRestApiAppConfig", "plugins = openedx.core.djangoapps.plugins.apps:PluginsConfig", - "schedules = openedx.core.djangoapps.schedules.apps:SchedulesConfig", "theming = openedx.core.djangoapps.theming.apps:ThemingConfig", "bookmarks = openedx.core.djangoapps.bookmarks.apps:BookmarksConfig", "zendesk_proxy = openedx.core.djangoapps.zendesk_proxy.apps:ZendeskProxyConfig",