'Renders the course\'s home page as a fragment.'

def render_to_fragment(self, request, course_id=None, **kwargs):

    course_key = CourseKey.from_string(course_id)
    course = get_course_overview_with_access(request.user, 'load', course_key, check_if_enrolled=True)
    course_url_name = default_course_url_name(course.id)
    course_url = reverse(course_url_name, kwargs={'course_id': unicode(course.id)})
    context = {'csrf': csrf(request)['csrf_token'], 'course': course, 'course_key': course_key, 'course_url': course_url, 'query': request.GET.get('query', ''), 'disable_courseware_js': True, 'uses_pattern_library': True}
    html = render_to_string('course_search/course-search-fragment.html', context)
    return Fragment(html)
