pythonopenedx

Openedx - Adding Mongo Definition Field while creating course


I am using Ironwood version and trying to add field "program". Call goes to function create_course and I find following error.

File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/modulestore/split_mongo/split.py", line 2007, in create_course
    search_targets, root_category, root_block_id, **kwargs
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/modulestore/split_mongo/split.py", line 2022, in _create_courselike
    partitioned_fields = self.partition_fields_by_scope(root_category, fields)
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/modulestore/__init__.py", line 1313, in partition_fields_by_scope
    field = getattr(cls, field_name)
AttributeError: type object 'CourseDescriptorWithMixins' has no attribute 'program'

Can anyone please guide what I am missing?


Solution

  • I have faced the same error, the issue got resolved when I added the field 'program' to common/lib/xmodule/xmodule/course_module.py.

    class CourseFields(object):
    ...
        program = String(
            display_name=_("Program"),
            help=_("Specify the program of course."),
            default=None,
            scope=Scope.settings
        )
    ...