openedx.core.djangoapps.models package#
Submodules#
openedx.core.djangoapps.models.course_details module#
CourseDetails
- class openedx.core.djangoapps.models.course_details.CourseDetails(org, course_id, run)#
Bases:
objectAn interface for extracting course information from the modulestore.
- classmethod fetch(course_key)#
Fetch the course details for the given course from persistence and return a CourseDetails model.
- classmethod fetch_about_attribute(course_key, attribute)#
Retrieve an attribute from a course’s “about” info
- classmethod fetch_video_url(course_key)#
Returns the course about video URL.
- classmethod fetch_youtube_video_id(course_key)#
Returns the course about video ID.
- static parse_video_tag(raw_video)#
Because the client really only wants the author to specify the youtube key, that’s all we send to and get from the client. The problem is that the db stores the html markup as well (which, of course, makes any site-wide changes to how we do videos next to impossible.)
- classmethod populate(block)#
Returns a fully populated CourseDetails model given the course block
- static recompose_video_tag(video_key)#
Returns HTML string to embed the video in an iFrame.
- classmethod update_about_item(course, about_key, data, user_id, store=None)#
Update the about item with the new data blob. If data is None, then delete the about item.
- classmethod update_about_video(course, video_id, user_id)#
Updates the Course’s about video to the given video ID.
- classmethod update_from_json(course_key, jsondict, user)#
Decode the json into CourseDetails and save any changed attrs to the db.
All writes are batched inside a single
bulk_operationscontext so that only onecourse_publishedsignal is emitted per call, regardless of how many individual fields were updated. Without this, everyupdate_item/delete_itemcall insideupdate_about_item(and the top-level block update) each fire their own signal, causing downstream tasks to run multiple times for a single user action.
- classmethod validate_certificate_settings(certificate_available_date, certificates_display_behavior)#
Takes the stored values for certificate_available_date and certificates_display_behavior and verifies they work together in tandem per ADR: lms/djangoapps/certificates/docs/decisions/005-cert-display-settings.rst
- Parameters:
stored_certificate_available_date (str) – certificate_available_date from the modulestore
stored_certificates_display_behavior (str)
- Returns:
updated certificate_available_date, updated certificates_display_behavior None
- Return type:
tuple[str, str]