'Render the discussion board to a fragment.
Args:
request: The Django request.
course_id: The id of the course in question.
discussion_id: An optional discussion ID to be focused upon.
thread_id: An optional ID of the thread to be shown.
Returns:
Fragment: The fragment representing the discussion board'

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

    course_key = CourseKey.from_string(course_id)
    try:
        base_context = _create_base_discussion_view_context(request, course_key)
        thread = (_load_thread_for_viewing(request, base_context['course'], discussion_id=discussion_id, thread_id=thread_id, raise_event=False) if thread_id else None)
        context = _create_discussion_board_context(request, base_context, thread=thread)
        html = render_to_string('discussion/discussion_board_fragment.html', context)
        inline_js = render_to_string('discussion/discussion_board_js.template', context)
        fragment = Fragment(html)
        self.add_fragment_resource_urls(fragment)
        fragment.add_javascript(inline_js)
        if (not settings.REQUIRE_DEBUG):
            fragment.add_javascript_url(staticfiles_storage.url('discussion/js/discussion_board_factory.js'))
        return fragment
    except cc.utils.CommentClientMaintenanceError:
        log.warning('Forum    is    in    maintenance    mode')
        html = render_to_response('discussion/maintenance_fragment.html', {'disable_courseware_js': True, 'uses_pattern_library': True})
        return Fragment(html)
