Files
edx-platform/lms/djangoapps/ccx/utils.py
Carlos de la Guardia 458ed0a64e Use the standard enrollment table instead of a custom CCX table for CCX
enrollments.

The goal for this PR is to have a single mechanism for registering users and
reducing the number of places where special-casing for ccx courses is needed. The
migration at this point is purposefully limited to convert ccx memberships into
student enrollments when moving forward. No backward migration is in place at the
moment. The ccx membership tables are not removed at this time. It is possible to go
backwards and forwards multiple times with no errors or data loss.
2015-08-01 02:59:10 -05:00

27 lines
639 B
Python

"""
CCX Enrollment operations for use by Coach APIs.
Does not include any access control, be sure to check access before calling.
"""
import logging
from .models import CustomCourseForEdX
log = logging.getLogger("edx.ccx")
def get_ccx_from_ccx_locator(course_id):
""" helper function to allow querying ccx fields from templates """
ccx_id = getattr(course_id, 'ccx', None)
ccx = None
if ccx_id:
ccx = CustomCourseForEdX.objects.filter(id=ccx_id)
if not ccx:
log.warning(
"CCX does not exist for course with id %s",
course_id
)
return None
return ccx[0]