openedx.core.djangoapps.content.course_overviews package

Contents

openedx.core.djangoapps.content.course_overviews package#

Subpackages#

Submodules#

openedx.core.djangoapps.content.course_overviews.api module#

CourseOverview api

openedx.core.djangoapps.content.course_overviews.api.get_course_overview_or_404(course_id)#

Retrieve and return course overview data for the provided course id.

If the course overview does not exist, raises Http404.

openedx.core.djangoapps.content.course_overviews.api.get_course_overview_or_none(course_id)#

Retrieve and return course overview data for the provided course id.

If the course overview does not exist, return None.

openedx.core.djangoapps.content.course_overviews.api.get_course_overviews(course_ids)#

Return (serialized) course_overview data for a given list of opaque_key course_ids.

openedx.core.djangoapps.content.course_overviews.api.get_course_overviews_from_ids(course_ids)#

Return course overviews for the specified course ids.

Params:

course_ids (iterable[CourseKey])

Returns:

dict[CourseKey, CourseOverview|None]

openedx.core.djangoapps.content.course_overviews.api.get_pseudo_course_overview(course_id)#

Returns a pseudo course overview object for a deleted course.

Params:

course_id (CourseKey): The identifier for the course.

Returns:

(Temporary) CourseOverview object representing for a deleted course.

openedx.core.djangoapps.content.course_overviews.apps module#

Configuration for course_overviews Django app

class openedx.core.djangoapps.content.course_overviews.apps.CourseOverviewsConfig(app_name, app_module)#

Bases: AppConfig

Configuration class for course_overviews Django app

name = 'openedx.core.djangoapps.content.course_overviews'#
ready()#

Override this method in subclasses to run code when Django starts.

verbose_name = 'Course Overviews'#

openedx.core.djangoapps.content.course_overviews.models module#

Declaration of CourseOverview model

class openedx.core.djangoapps.content.course_overviews.models.CourseOverview(*args, **kwargs)#

Bases: TimeStampedModel

Model for storing and caching basic information about a course.

This model contains basic course metadata such as an ID, display name, image URL, and any other information that would be necessary to display a course as part of:

user dashboard (enrolled courses) course catalog (courses to enroll in) course about (meta data about the course)

When you bump the VERSION you will invalidate all existing course overviews. This will cause a slew of modulestore reads as each course needs to be re-cached into the course overview.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

VERSION = 19#
advertised_start#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

allow_proctoring_opt_out#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property allow_public_wiki_access#

move this to the model.

Type:

TODO

announcement#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

apply_cdn_to_url(image_url)#

Applies a new CDN/base URL to the given URLs if CDN configuration is enabled.

If CDN does not exist or is disabled, just returns the original. The URL that we store in CourseOverviewImageSet is already top level path, so we don’t need to go through the /static remapping magic that happens with other course assets. We just need to add the CDN server if appropriate.

apply_cdn_to_urls(image_urls)#

Given a dict of resolutions -> urls, return a copy with CDN applied.

If CDN does not exist or is disabled, just returns the original. The URLs that we store in CourseOverviewImageSet are all already top level paths, so we don’t need to go through the /static remapping magic that happens with other course assets. We just need to add the CDN server if appropriate.

authz_scopes#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

banner_image_url#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

bind_course_for_student(request)#

Bind user-specific field data to the Course XBlock.

By default, the retrieved course XBlock is “unbound” - it means that any field from the user_info scope (like edxnotes_visibility) returns its default value.

catalog_visibility#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

cert_html_view_enabled#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

cert_name_long#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

cert_name_short#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

certificate_available_date#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

certificates_display_behavior#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

certificates_show_before_end#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

clean_id(padding_char='=')#

Returns a unique deterministic base32-encoded ID for the course.

Parameters:

padding_char (str) – Character used for padding at end of base-32 -encoded string, defaulting to ‘=’

property closest_released_language#

Returns the language code that most closely matches this course’ language and is fully supported by the LMS, or None if there are no fully supported languages that match the target.

contenttypegatingconfig_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

classmethod course_exists(course_id)#

Check whether a course run exists (in CourseOverviews _or_ modulestore).

Checks the CourseOverview table first. If it is not there, check the modulestore. Equivalent to, but more efficient than:

bool(CourseOverview.get_from_id(course_id))

Parameters:

course_id (CourseKey)

Returns: bool

course_image_url#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

course_video_url#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property course_visibility#

move this to the model.

Type:

TODO

coursedurationlimitconfig_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

courseenrollment_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

courseentitlementsupportdetail_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

created#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property dashboard_start_display#

Return start date to diplay on learner’s dashboard, preferably Course Advertised Start

days_early_for_beta#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

disableprogresspagestackedconfig_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

discountpercentageconfig_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

discountrestrictionconfig_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

display_name#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property display_name_with_default#

Return reasonable display name for the course.

property display_name_with_default_escaped#

use display_name_with_default

Return html escaped reasonable display name for the course.

Note: This newly introduced method should not be used. It was only introduced to enable a quick search/replace and the ability to slowly migrate and test switching to display_name_with_default, which is no longer escaped.

Type:

DEPRECATED

display_number_with_default#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

display_org_with_default#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property edxnotes#

move this to the model.

Type:

TODO

property edxnotes_visibility#

move this to the model.

Type:

TODO

effort#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

eligible_for_financial_aid#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property enable_ccx#

move this to the model.

Type:

TODO

enable_proctored_exams#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

end#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

end_date#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

end_of_course_survey_url#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

enrollment_domain#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

enrollment_end#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

enrollment_start#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

entrance_exam_enabled#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

entrance_exam_id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

entrance_exam_minimum_score_pct#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

external_id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

force_on_flexible_peer_openassessments#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

classmethod get_all_course_keys()#

Returns all course keys from course overviews.

classmethod get_all_courses(orgs=None, filter_=None, active_only=False, course_keys=None)#

Return a queryset containing all CourseOverview objects in the database.

Parameters:
  • orgs (list[string]) – Optional parameter that allows case-insensitive filtering by organization.

  • filter (dict) – Optional parameter that allows custom filtering.

  • active_only (bool) – If provided, only the courses that have not ended will be returned.

  • course_keys (list[string]) – Optional parameter that allows case-insensitive filter by course ids

classmethod get_courses_by_status(active_only, archived_only, course_overviews)#

Return a queryset of CourseOverview objects based on the given status.

Parameters:
  • active_only – when True, only active courses will be returned.

  • archived_only – when True, only archived courses will be returned.

  • course_overviews – queryset of CourseOverview objects to filter on.

classmethod get_courses_matching_query(query, course_overviews)#

Return a queryset of CourseOverview objects filtered bythe given query.

Parameters:
  • query – required parameter that allows filtering based on the CourseOverview.

  • course_overviews – queryset of CourseOverview objects to filter on.

classmethod get_from_id(course_id)#

Load a CourseOverview object for a given course ID.

First, we try to load the CourseOverview from the database. If it doesn’t exist, we load the entire course from the modulestore, create a CourseOverview object from it, and then cache it in the database for future use.

Parameters:

course_id (CourseKey) – the ID of the course overview to be loaded.

Returns:

overview of the requested course.

Return type:

CourseOverview

Raises:
  • - CourseOverview.DoesNotExist if the course specified by course_id – was not found.

  • - IOError if some other error occurs while trying to load the – course from the module store.

classmethod get_from_ids(course_ids)#

Return a dict mapping course_ids to CourseOverviews.

Tries to select all CourseOverviews in one query, then fetches remaining (uncached) overviews from the modulestore.

Course IDs for non-existant courses will map to None.

Parameters:

course_ids (iterable[CourseKey])

Returns: dict[CourseKey, CourseOverview|None]

get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=True, **kwargs)#
get_previous_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
has_any_active_web_certificate#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

has_ended()#

Returns whether the course has ended.

has_highlights#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

has_marketing_url()#

Returns whether the course has marketing url.

has_social_sharing_url()#

Returns whether the course has social sharing url.

has_started()#

Returns whether the the course has started.

property hide_progress_tab#

move this to the model.

Type:

TODO

history = <django.db.models.manager.HistoryManagerFromHistoricalQuerySet object>#
property html_textbooks#

move this to the model.

Type:

TODO

id#

DO NOT REUSE THIS CLASS. Provided for backwards compatibility only!

A placeholder class that provides a way to set the attribute on the model.

image_set#

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

property image_urls#

Return a dict with all known URLs for this course image.

Current resolutions are:

raw = original upload from the user small = thumbnail with dimensions CourseOverviewImageConfig.current().small large = thumbnail with dimensions CourseOverviewImageConfig.current().large

If no thumbnails exist, the raw (originally uploaded) image will be returned for all resolutions.

invitation_only#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_discussion_tab_enabled(user=None)#

Returns True if course has discussion tab and is enabled

is_enrollment_open()#

Returns True if course enrollment is open

language#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

classmethod load_from_module_store(course_id)#

Load a CourseBlock, create or update a CourseOverview from it, cache the overview, and return it.

Parameters:

course_id (CourseKey) – the ID of the course overview to be loaded.

Returns:

overview of the requested course.

Return type:

CourseOverview

Raises:
  • - CourseOverview.DoesNotExist if the course specified by course_id – was not found.

  • - IOError if some other error occurs while trying to load the – course from the module store.

property location#

The old name for usage_key. This method is analogous to XModuleMixin.location.

lowest_passing_grade#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

marketing_url#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

max_student_enrollments_allowed#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

mobile_available#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

modes#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

modified#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property number#

Returns this course’s number.

This is a “number” in the sense of the “course numbers” that you see at lots of universities. For example, given a course “Intro to Computer Science” with the course key “edX/CS-101/2014”, the course number would be “CS-101”

objects = <django.db.models.manager.Manager object>#
org#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property pacing#

Returns the pacing for the course.

Potential values:

self: Self-paced courses instructor: Instructor-led courses

property pdf_textbooks#

move this to the model.

Type:

TODO

property pre_requisite_courses#

Returns a list of ID strings for this course’s prerequisite courses.

proctoring_escalation_email#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

proctoring_provider#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

providerfilter_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

save_without_historical_record(*args, **kwargs)#

Save the model instance without creating a historical record.

Make sure you know what you’re doing before using this method.

self_paced#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

selfpacedrelativedatesconfig_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

short_description#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property show_calculator#

move this to the model.

Type:

TODO

social_sharing_url#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property sorting_score#

Returns a tuple that can be used to sort the courses according the how “new” they are. The “newness” score is computed using a heuristic that takes into account the announcement and (advertised) start dates of the course if available.

The lower the number the “newer” the course.

start#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

start_date#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property start_date_is_still_default#

Checks if the start date set for the course is still default, i.e. .start has not been modified, and .advertised_start has not been set.

property start_display#

Returns the display value for the course’s start date.

property start_type#

Returns the type of the course’s ‘start’ field.

starts_within(days)#

Returns True if the course starts with-in given number of days otherwise returns False.

tab_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

property tabs#

Returns an iterator of CourseTabs.

property teams_enabled#

move this to the model.

Type:

TODO

property textbooks#

move this to the model.

Type:

TODO

classmethod update_select_courses(course_keys, force_update=False)#

A side-effecting method that updates CourseOverview objects for the given course_keys.

Parameters:
  • course_keys (list[CourseKey]) – Identifies for which courses to return CourseOverview objects.

  • force_update (boolean) – Optional parameter that indicates whether the requested CourseOverview objects should be forcefully updated (i.e., re-synched with the modulestore).

property url_name#

The old name for block_id. This method is analogous to XModuleMixin.url_name.

property usage_key#

Returns the UsageKey of the root block of this course.

UsageKeyField has a strange behavior where it fails to parse the “run” of a course out of the serialized form of a Mongo Draft UsageKey. This method is a wrapper around _location attribute that fixes the problem by calling map_into_course, which restores the run attribute.

version#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

visible_to_staff_only#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

exception openedx.core.djangoapps.content.course_overviews.models.CourseOverviewCaseMismatchException#

Bases: Exception

class openedx.core.djangoapps.content.course_overviews.models.CourseOverviewImageConfig(*args, **kwargs)#

Bases: ConfigurationModel

This sets the size of the thumbnail images that Course Overviews will generate to display on the about, info, and student dashboard pages. If you make any changes to this, you will have to regenerate CourseOverviews in order for it to take effect. You might want to do this if you’re doing precise theming of your install of edx-platform… but really, you probably don’t want to do this at all at the moment, given how new this is. :-P

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

change_date#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

changed_by#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

changed_by_id#
enabled#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_change_date(*, field=<django.db.models.fields.DateTimeField: change_date>, is_next=True, **kwargs)#
get_previous_by_change_date(*, field=<django.db.models.fields.DateTimeField: change_date>, is_next=False, **kwargs)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property large#

Tuple for large image dimensions in pixels – (width, height)

large_height#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

large_width#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property small#

Tuple for small image dimensions in pixels – (width, height)

small_height#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

small_width#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class openedx.core.djangoapps.content.course_overviews.models.CourseOverviewImageSet(*args, **kwargs)#

Bases: TimeStampedModel

Model for Course overview images. Each column is an image type/size.

You should basically never use this class directly. Read from CourseOverview.image_urls instead.

Special Notes on Deployment/Rollback/Changes:

  1. By default, this functionality is disabled. To turn it on, you have to create a CourseOverviewImageConfig entry via Django Admin and select enabled=True.

  2. If it is enabled in configuration, it will lazily create thumbnails as individual CourseOverviews are requested. This is independent of the CourseOverview’s cls.VERSION scheme. This is to better support the use case where someone might want to change the thumbnail resolutions for their theme – we didn’t want to tie the code-based data schema of CourseOverview to configuration changes.

  3. A CourseOverviewImageSet is automatically deleted when the CourseOverview it belongs to is deleted. So it will be regenerated whenever there’s a new publish or the CourseOverview schema version changes. It’s not particularly smart about this, and will just re-write the same thumbnails over and over to the same location without checking to see if there were changes.

  4. Just because a CourseOverviewImageSet is successfully created does not mean that any thumbnails exist. There might have been a processing error, or there might simply be no source image to create a thumbnail out of. In this case, accessing CourseOverview.image_urls will return the value for course.course_image_url for all resolutions. CourseOverviewImageSet will not try to regenerate if there is a model entry with blank values for the URLs – the assumption is that either there’s no data there or something has gone wrong and needs fixing in code.

  5. If you want to change thumbnail resolutions, you need to create a new CourseOverviewImageConfig with the desired dimensions and then wipe the values in CourseOverviewImageSet.

Logical next steps that I punted on for this first cut:

  1. Converting other parts of the app to use this.

    Our first cut only affects About Pages and the Student Dashboard. But most places that use course_image_url() should be converted – e.g. course discovery, mobile, etc.

  2. Center cropping the image before scaling.

    This is desirable, but it involves a few edge cases (what the rounding policy is, what to do with undersized images, etc.) The behavior that we implemented is at least no worse than what was already there in terms of distorting images.

  3. Automatically invalidating entries based on CourseOverviewImageConfig.

    There are two basic paths I can think of for this. The first is to completely wipe this table when the config changes. The second is to actually tie the config as a foreign key from this model – so you could do the comparison to see if the image_set’s config_id matched CourseOverviewImageConfig.current() and invalidate it if they didn’t match. I punted on this mostly because it’s just not something that happens much at all in practice, there is an understood (if manual) process to do it, and it can happen in a follow-on PR if anyone is interested in extending this functionality.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

course_overview#

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

course_overview_id#
classmethod create(course_overview, course=None)#

Create thumbnail images for this CourseOverview.

This will save the CourseOverviewImageSet before it returns.

created#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=True, **kwargs)#
get_previous_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

large_url#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

modified#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
small_url#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class openedx.core.djangoapps.content.course_overviews.models.CourseOverviewTab(*args, **kwargs)#

Bases: Model

Model for storing and caching tabs information of a course.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

course_overview#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

course_overview_id#
course_staff_only#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_hidden#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

name#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
tab_id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

type#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

url_slug#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class openedx.core.djangoapps.content.course_overviews.models.SimulateCoursePublishConfig(*args, **kwargs)#

Bases: ConfigurationModel

Manages configuration for a run of the simulate_publish management command.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

arguments#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

change_date#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

changed_by#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

changed_by_id#
enabled#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_change_date(*, field=<django.db.models.fields.DateTimeField: change_date>, is_next=True, **kwargs)#
get_previous_by_change_date(*, field=<django.db.models.fields.DateTimeField: change_date>, is_next=False, **kwargs)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

openedx.core.djangoapps.content.course_overviews.serializers module#

CourseOverview serializers

class openedx.core.djangoapps.content.course_overviews.serializers.CourseOverviewBaseSerializer(*args, **kwargs)#

Bases: ModelSerializer

Serializer for a course run overview.

class Meta#

Bases: object

fields = '__all__'#
model#

alias of CourseOverview

to_representation(instance)#

Object instance -> Dict of primitive datatypes.

openedx.core.djangoapps.content.course_overviews.signals module#

Signal handler for invalidating cached course overviews

openedx.core.djangoapps.content.course_overviews.signals.trigger_import_course_details_signal(sender, instance, created, **kwargs)#

Triggers the IMPORT_COURSE_DETAILS signal which will be handled in federated_content_connector plugin

openedx.core.djangoapps.content.course_overviews.tasks module#

openedx.core.djangoapps.content.course_overviews.tasks.chunks(sequence, chunk_size)#
openedx.core.djangoapps.content.course_overviews.tasks.enqueue_async_course_overview_update_tasks(course_ids, all_courses=False, force_update=False, chunk_size=50, routing_key=None)#

Module contents#

Library for quickly accessing basic course metadata.

The rationale behind this app is that loading course metadata from the Split Mongo Modulestore is too slow. See:

https://openedx.atlassian.net/wiki/pages/viewpage.action?spaceKey=MA&title= MA-296%3A+UserCourseEnrollmentList+Performance+Investigation

This performance issue is not a problem when loading metadata for a single course; however, there are many cases in LMS where we need to load metadata for a number of courses simultaneously, which can cause very noticeable latency. Specifically, the endpoint /api/mobile_api/v0.5/users/{username}/course_enrollments took an average of 900 ms, and all it does is generate a limited amount of data for no more than a few dozen courses per user.

In this app we declare the model CourseOverview, which caches course metadata and a MySQL table and allows very quick access to it (according to NewRelic, less than 1 ms). To load a CourseOverview, call CourseOverview.get_from_id with the appropriate course key. The use cases for this app include things like a user enrollment dashboard, a course metadata API, or a course marketing page.