def get_ccx_from_ccx_locator(course_id):
 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]

def get_ccx_from_ccx_locator ( course_id ) : 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 ]
helper function to allow querying ccx fields from templates .