* Generate common/djangoapps import shims for LMS * Generate common/djangoapps import shims for Studio * Stop appending project root to sys.path * Stop appending common/djangoapps to sys.path * Import from common.djangoapps.course_action_state instead of course_action_state * Import from common.djangoapps.course_modes instead of course_modes * Import from common.djangoapps.database_fixups instead of database_fixups * Import from common.djangoapps.edxmako instead of edxmako * Import from common.djangoapps.entitlements instead of entitlements * Import from common.djangoapps.pipline_mako instead of pipeline_mako * Import from common.djangoapps.static_replace instead of static_replace * Import from common.djangoapps.student instead of student * Import from common.djangoapps.terrain instead of terrain * Import from common.djangoapps.third_party_auth instead of third_party_auth * Import from common.djangoapps.track instead of track * Import from common.djangoapps.util instead of util * Import from common.djangoapps.xblock_django instead of xblock_django * Add empty common/djangoapps/__init__.py to fix pytest collection * Fix pylint formatting violations * Exclude import_shims/ directory tree from linting
63 lines
2.4 KiB
Python
63 lines
2.4 KiB
Python
"""
|
|
Django admin dashboard configuration.
|
|
"""
|
|
|
|
|
|
from config_models.admin import ConfigurationModelAdmin, KeyedConfigurationModelAdmin
|
|
from django.contrib import admin
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from common.djangoapps.xblock_django.models import XBlockConfiguration, XBlockStudioConfiguration, XBlockStudioConfigurationFlag
|
|
|
|
|
|
class XBlockConfigurationAdmin(KeyedConfigurationModelAdmin):
|
|
"""
|
|
Admin for XBlockConfiguration.
|
|
"""
|
|
fieldsets = (
|
|
('XBlock Name', {
|
|
'fields': ('name',)
|
|
}),
|
|
('Enable/Disable XBlock', {
|
|
'description': _('To disable the XBlock and prevent rendering in the LMS, leave "Enabled" deselected; '
|
|
'for clarity, update XBlockStudioConfiguration support state accordingly.'),
|
|
'fields': ('enabled',)
|
|
}),
|
|
('Deprecate XBlock', {
|
|
'description': _("Only XBlocks listed in a course's Advanced Module List can be flagged as deprecated. "
|
|
"Remember to update XBlockStudioConfiguration support state accordingly, as deprecated "
|
|
"does not impact whether or not new XBlock instances can be created in Studio."),
|
|
'fields': ('deprecated',)
|
|
}),
|
|
)
|
|
|
|
|
|
class XBlockStudioConfigurationAdmin(KeyedConfigurationModelAdmin):
|
|
"""
|
|
Admin for XBlockStudioConfiguration.
|
|
"""
|
|
fieldsets = (
|
|
('', {
|
|
'fields': ('name', 'template')
|
|
}),
|
|
('Enable Studio Authoring', {
|
|
'description': _(
|
|
'XBlock/template combinations that are disabled cannot be edited in Studio, regardless of support '
|
|
'level. Remember to also check if all instances of the XBlock are disabled in XBlockConfiguration.'
|
|
),
|
|
'fields': ('enabled',)
|
|
}),
|
|
('Support Level', {
|
|
'description': _(
|
|
"Enabled XBlock/template combinations with full or provisional support can always be created "
|
|
"in Studio. Unsupported XBlock/template combinations require course author opt-in."
|
|
),
|
|
'fields': ('support_level',)
|
|
}),
|
|
)
|
|
|
|
|
|
admin.site.register(XBlockConfiguration, XBlockConfigurationAdmin)
|
|
admin.site.register(XBlockStudioConfiguration, XBlockStudioConfigurationAdmin)
|
|
admin.site.register(XBlockStudioConfigurationFlag, ConfigurationModelAdmin)
|