EDX : How to set default advanced components for newly created course

1.2k views Asked by At

I have created a xblock, now I want to set this xblock as default xblock as an advanced component for every newly created course automatically.

Thanks.

3

There are 3 answers

0
Régis B. On

You need to add your XBlock to the list of advanced components. In your CMS settings file, add:

ADVANCED_COMPONENT_TYPES.append('your_xblock')
0
D.W On

the right way to solve this problem is to edit the CourseFields class under common/lib/xmodule/xmodule/course_module.py file. You will find that there is a class variable called advanced_modules with type List. you can just do something like this

advanced_modules = List(
    display_name=_("Advanced Module List"),
    default=[], # this is where you add default values 
    help=_("Enter the names of the advanced components to use in your course."),
    scope=Scope.settings
)
0
Dadaso Zanzane On

Setup default advanced component

edit the following file

cms/djangoapps/contentstore/views/components.py

Add the following line to function ‘get_component_templates()’ After

if isinstance(course_advanced_keys, list):

Add

course_advanced_keys.append('your_xblock')