Merge pull request #17385 from mitodl/hack18_instructor_django_plugin

Changed 'instructor' django app to follow plugin pattern
This commit is contained in:
Nimisha Asthagiri
2018-03-26 15:20:47 -06:00
committed by GitHub
13 changed files with 101 additions and 68 deletions

View File

@@ -5,14 +5,34 @@ Instructor Application Configuration
from django.apps import AppConfig
from django.conf import settings
from edx_proctoring.runtime import set_runtime_service
from openedx.core.constants import COURSE_ID_PATTERN
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType, PluginURLs, PluginSettings
class InstructorConfig(AppConfig):
"""
Default configuration for the "lms.djangoapps.instructor" Django application.
Application Configuration for Instructor.
"""
name = u'lms.djangoapps.instructor'
plugin_app = {
PluginURLs.CONFIG: {
ProjectType.LMS: {
PluginURLs.NAMESPACE: u'',
PluginURLs.REGEX: u'courses/{}/instructor/api/'.format(COURSE_ID_PATTERN),
PluginURLs.RELATIVE_PATH: u'views.api_urls',
}
},
PluginSettings.CONFIG: {
ProjectType.LMS: {
SettingsType.DEVSTACK: {PluginSettings.RELATIVE_PATH: u'settings.devstack'},
SettingsType.AWS: {PluginSettings.RELATIVE_PATH: u'settings.aws'},
SettingsType.COMMON: {PluginSettings.RELATIVE_PATH: u'settings.common'},
SettingsType.TEST: {PluginSettings.RELATIVE_PATH: u'settings.test'},
}
}
}
def ready(self):
if settings.FEATURES.get('ENABLE_SPECIAL_EXAMS'):
from .services import InstructorService

View File

@@ -0,0 +1,20 @@
"""AWS environment variables unique to the instructor plugin."""
import warnings
def plugin_settings(settings):
"""Settings for the instructor plugin."""
# Analytics Dashboard
settings.ANALYTICS_DASHBOARD_URL = settings.ENV_TOKENS.get(
"ANALYTICS_DASHBOARD_URL", settings.ANALYTICS_DASHBOARD_URL
)
settings.ANALYTICS_DASHBOARD_NAME = settings.ENV_TOKENS.get(
"ANALYTICS_DASHBOARD_NAME", settings.ANALYTICS_DASHBOARD_NAME
)
# Backward compatibility for deprecated feature names
if 'ENABLE_S3_GRADE_DOWNLOADS' in settings.FEATURES:
warnings.warn(
"'ENABLE_S3_GRADE_DOWNLOADS' is deprecated. Please use 'ENABLE_GRADE_DOWNLOADS' instead",
DeprecationWarning,
)
settings.FEATURES['ENABLE_GRADE_DOWNLOADS'] = settings.FEATURES['ENABLE_S3_GRADE_DOWNLOADS']

View File

@@ -0,0 +1,42 @@
"""Common environment variables unique to the instructor plugin."""
from django.utils.translation import ugettext_lazy as _
def plugin_settings(settings):
"""Settings for the instructor plugin."""
### Analytics Dashboard (Insights) settings
settings.ANALYTICS_DASHBOARD_URL = ""
settings.ANALYTICS_DASHBOARD_NAME = _('Your Platform Insights')
settings.FEATURES.update({
# Enable display of enrollment counts in instructor dash, analytics section
'DISPLAY_ANALYTICS_ENROLLMENTS': True,
# Display the 'Analytics' tab in the instructor dashboard for CCX courses.
# Note: This has no effect unless ANALYTICS_DASHBOARD_URL is already set,
# because without that setting, the tab does not show up for any courses.
'ENABLE_CCX_ANALYTICS_DASHBOARD_URL': False,
# Disable instructor dash buttons for downloading course data
# when enrollment exceeds this number
'MAX_ENROLLMENT_INSTR_BUTTONS': 200,
# Grade calculation started from the instructor dashboard will write grades
# CSV files to the configured storage backend and give links for downloads.
'ENABLE_GRADE_DOWNLOADS': False,
# Give course staff unrestricted access to grade downloads (if set to False,
# only edX superusers can perform the downloads)
'ALLOW_COURSE_STAFF_GRADE_DOWNLOADS': False,
# Show a section in the membership tab of the instructor dashboard
# to allow an upload of a CSV file that contains a list of new accounts to create
# and register for course.
'ALLOW_AUTOMATED_SIGNUPS': False,
# Batch-Generated Certificates from Instructor Dashboard
'CERTIFICATES_INSTRUCTOR_GENERATION': False,
# Whether to check the "Notify users by email" checkbox in the batch enrollment form
# in the instructor dashboard.
'BATCH_ENROLLMENT_NOTIFY_USERS_DEFAULT': True,
})

View File

@@ -0,0 +1,8 @@
"""Devstack environment variables unique to the instructor plugin."""
def plugin_settings(settings):
"""Settings for the instructor plugin."""
# Set this to the dashboard URL in order to display the link from the
# dashboard to the Analytics Dashboard.
settings.ANALYTICS_DASHBOARD_URL = None

View File

@@ -0,0 +1,8 @@
"""Test suite environment variables unique to the instructor plugin."""
def plugin_settings(settings):
"""Settings for the instructor plugin."""
# Enable this feature for course staff grade downloads, to enable acceptance tests
settings.FEATURES['ENABLE_GRADE_DOWNLOADS'] = True
settings.FEATURES['ALLOW_COURSE_STAFF_GRADE_DOWNLOADS'] = True

View File

@@ -19,7 +19,6 @@ Common traits:
import datetime
import json
import warnings
import dateutil
@@ -180,14 +179,6 @@ ENV_FEATURES = ENV_TOKENS.get('FEATURES', {})
for feature, value in ENV_FEATURES.items():
FEATURES[feature] = value
# Backward compatibility for deprecated feature names
if 'ENABLE_S3_GRADE_DOWNLOADS' in FEATURES:
warnings.warn(
"'ENABLE_S3_GRADE_DOWNLOADS' is deprecated. Please use 'ENABLE_GRADE_DOWNLOADS' instead",
DeprecationWarning,
)
FEATURES['ENABLE_GRADE_DOWNLOADS'] = FEATURES['ENABLE_S3_GRADE_DOWNLOADS']
CMS_BASE = ENV_TOKENS.get('CMS_BASE', 'studio.edx.org')
ALLOWED_HOSTS = [
@@ -575,10 +566,6 @@ DATADOG.update(ENV_TOKENS.get("DATADOG", {}))
if 'DATADOG_API' in AUTH_TOKENS:
DATADOG['api_key'] = AUTH_TOKENS['DATADOG_API']
# Analytics Dashboard
ANALYTICS_DASHBOARD_URL = ENV_TOKENS.get("ANALYTICS_DASHBOARD_URL", ANALYTICS_DASHBOARD_URL)
ANALYTICS_DASHBOARD_NAME = ENV_TOKENS.get("ANALYTICS_DASHBOARD_NAME", ANALYTICS_DASHBOARD_NAME)
# Analytics API
ANALYTICS_API_KEY = AUTH_TOKENS.get("ANALYTICS_API_KEY", ANALYTICS_API_KEY)
ANALYTICS_API_URL = ENV_TOKENS.get("ANALYTICS_API_URL", ANALYTICS_API_URL)

View File

@@ -204,21 +204,9 @@ FEATURES = {
# Automatically approve student identity verification attempts
'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING': False,
# Disable instructor dash buttons for downloading course data
# when enrollment exceeds this number
'MAX_ENROLLMENT_INSTR_BUTTONS': 200,
# Grade calculation started from the instructor dashboard will write grades
# CSV files to the configured storage backend and give links for downloads.
'ENABLE_GRADE_DOWNLOADS': False,
# whether to use password policy enforcement or not
'ENFORCE_PASSWORD_POLICY': True,
# Give course staff unrestricted access to grade downloads (if set to False,
# only edX superusers can perform the downloads)
'ALLOW_COURSE_STAFF_GRADE_DOWNLOADS': False,
'ENABLED_PAYMENT_REPORTS': [
"refund_report",
"itemized_purchase_report",
@@ -278,14 +266,6 @@ FEATURES = {
# Enable organizational email opt-in
'ENABLE_MKTG_EMAIL_OPT_IN': False,
# Show a section in the membership tab of the instructor dashboard
# to allow an upload of a CSV file that contains a list of new accounts to create
# and register for course.
'ALLOW_AUTOMATED_SIGNUPS': False,
# Enable display of enrollment counts in instructor dash, analytics section
'DISPLAY_ANALYTICS_ENROLLMENTS': True,
# Show the mobile app links in the footer
'ENABLE_FOOTER_MOBILE_APP_LINKS': False,
@@ -329,9 +309,6 @@ FEATURES = {
# Certificates Web/HTML Views
'CERTIFICATES_HTML_VIEW': False,
# Batch-Generated Certificates from Instructor Dashboard
'CERTIFICATES_INSTRUCTOR_GENERATION': False,
# Course discovery feature
'ENABLE_COURSE_DISCOVERY': False,
@@ -382,11 +359,6 @@ FEATURES = {
# making multiple queries.
'ENABLE_READING_FROM_MULTIPLE_HISTORY_TABLES': True,
# Display the 'Analytics' tab in the instructor dashboard for CCX courses.
# Note: This has no effect unless ANALYTICS_DASHBOARD_URL is already set,
# because without that setting, the tab does not show up for any courses.
'ENABLE_CCX_ANALYTICS_DASHBOARD_URL': False,
# Set this to False to facilitate cleaning up invalid xml from your modulestore.
'ENABLE_XBLOCK_XML_VALIDATION': True,
@@ -410,10 +382,6 @@ FEATURES = {
# Allow users to change their email address.
'ALLOW_EMAIL_ADDRESS_CHANGE': True,
# Whether to check the "Notify users by email" checkbox in the batch enrollment form
# in the instructor dashboard.
'BATCH_ENROLLMENT_NOTIFY_USERS_DEFAULT': True,
# Whether the bulk enrollment view is enabled.
'ENABLE_BULK_ENROLLMENT_VIEW': False,
@@ -2127,7 +2095,6 @@ INSTALLED_APPS = [
'util',
'lms.djangoapps.certificates.apps.CertificatesConfig',
'dashboard',
'lms.djangoapps.instructor.apps.InstructorConfig',
'lms.djangoapps.instructor_task',
'openedx.core.djangoapps.course_groups',
'bulk_email',
@@ -2969,10 +2936,6 @@ ADVANCED_SECURITY_CONFIG = {}
SHIBBOLETH_DOMAIN_PREFIX = 'shib:'
OPENID_DOMAIN_PREFIX = 'openid:'
### Analytics Dashboard (Insights) settings
ANALYTICS_DASHBOARD_URL = ""
ANALYTICS_DASHBOARD_NAME = _('Your Platform Insights')
### Analytics API
ANALYTICS_API_KEY = ""
ANALYTICS_API_URL = "http://localhost:18100"

View File

@@ -41,12 +41,6 @@ for log_name, log_level in LOG_OVERRIDES:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
########################## ANALYTICS TESTING ########################
# Set this to the dashboard URL in order to display the link from the
# dashboard to the Analytics Dashboard.
ANALYTICS_DASHBOARD_URL = None
############################ PYFS XBLOCKS SERVICE #############################
# Set configuration for Django pyfilesystem

View File

@@ -71,10 +71,6 @@ FEATURES['ENABLE_SHOPPING_CART'] = True
FEATURES['ENABLE_VERIFIED_CERTIFICATES'] = True
# Enable this feature for course staff grade downloads, to enable acceptance tests
FEATURES['ENABLE_GRADE_DOWNLOADS'] = True
FEATURES['ALLOW_COURSE_STAFF_GRADE_DOWNLOADS'] = True
# Toggles embargo on for testing
FEATURES['EMBARGO'] = True

View File

@@ -482,11 +482,6 @@ urlpatterns += [
instructor_dashboard_views.set_course_mode_price,
name='set_course_mode_price',
),
url(
r'^courses/{}/instructor/api/'.format(
settings.COURSE_ID_PATTERN,
),
include('lms.djangoapps.instructor.views.api_urls')),
url(
r'^courses/{}/remove_coupon$'.format(
settings.COURSE_ID_PATTERN,

View File

@@ -1,5 +1,5 @@
"""
Constants that are relevant all of Open edX
Constants that are relevant to all of Open edX
"""
# These are standard regexes for pulling out info like course_ids, usage_ids, etc.
# They are used so that URLs with deprecated-format strings still work.

View File

@@ -71,9 +71,9 @@ setup(
"plugins = openedx.core.djangoapps.plugins.apps:PluginsConfig",
"schedules = openedx.core.djangoapps.schedules.apps:SchedulesConfig",
"theming = openedx.core.djangoapps.theming.apps:ThemingConfig",
"instructor = lms.djangoapps.instructor.apps:InstructorConfig",
"bookmarks = openedx.core.djangoapps.bookmarks.apps:BookmarksConfig",
"zendesk_proxy = openedx.core.djangoapps.zendesk_proxy.apps:ZendeskProxyConfig",
"instructor = lms.djangoapps.instructor.apps:InstructorConfig",
],
"cms.djangoapp": [
"ace_common = openedx.core.djangoapps.ace_common.apps:AceCommonConfig",