Пример #1
0
def get_course_last_published(course_key):
    """
    We use the CourseStructure table to get when this course was last
    published.
    Args:
        course_key: a CourseKey

    Returns: The datetime the course was last published at, converted into
        text, or None, if there's no record of the last time this course
        was published.
    """
    # Import is placed here to avoid model import at project startup.
    from xmodule.modulestore.django import modulestore
    from openedx.core.djangoapps.content.block_structure.models import BlockStructureModel
    from openedx.core.djangoapps.content.block_structure.exceptions import BlockStructureNotFound

    store = modulestore()
    course_usage_key = store.make_course_usage_key(course_key)
    try:
        structure = BlockStructureModel.get(course_usage_key)
        course_last_published_date = six.text_type(structure.modified)
    except BlockStructureNotFound:
        course_last_published_date = None

    return course_last_published_date
Пример #2
0
def get_course_last_published(course_key):
    """
    We use the CourseStructure table to get when this course was last
    published.
    Args:
        course_key: a CourseKey

    Returns: The datetime the course was last published at, converted into
        text, or None, if there's no record of the last time this course
        was published.
    """
    # Import is placed here to avoid model import at project startup.
    from xmodule.modulestore.django import modulestore
    from openedx.core.djangoapps.content.block_structure.models import BlockStructureModel
    from openedx.core.djangoapps.content.block_structure.exceptions import BlockStructureNotFound

    store = modulestore()
    course_usage_key = store.make_course_usage_key(course_key)
    try:
        structure = BlockStructureModel.get(course_usage_key)
        course_last_published_date = six.text_type(structure.modified)
    except BlockStructureNotFound:
        course_last_published_date = None

    return course_last_published_date