'Gets a list of CCX Courses for a given Master Course.
Additional parameters are allowed for pagination purposes.
Args:
request (Request): Django request object.
Return:
A JSON serialized representation of a list of CCX courses.'

def get(self, request):

    master_course_id = request.GET.get('master_course_id')
    (master_course_object, master_course_key, error_code, http_status) = get_valid_course(master_course_id)
    if (master_course_object is None):
        return Response(status=http_status, data={'error_code': error_code})
    queryset = CustomCourseForEdX.objects.filter(course_id=master_course_key)
    order_by_input = request.query_params.get('order_by')
    sort_order_input = request.query_params.get('sort_order')
    if (order_by_input in ('id', 'display_name')):
        sort_direction = ''
        if (sort_order_input == 'desc'):
            sort_direction = '-'
        queryset = queryset.order_by('{0}{1}'.format(sort_direction, order_by_input))
    page = self.paginate_queryset(queryset)
    serializer = self.get_serializer(page, many=True)
    response = self.get_paginated_response(serializer.data)
    return response
