'Shows logs of imports that happened as a result of a git import'

@method_decorator(login_required)
def get(self, request, *args, **kwargs):

    course_id = kwargs.get('course_id')
    if course_id:
        course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)
    page_size = 10
    mongo_db = {'host': 'localhost', 'user': '', 'password': '', 'db': 'xlog'}
    if hasattr(settings, 'MONGODB_LOG'):
        for config_item in ['host', 'user', 'password', 'db']:
            mongo_db[config_item] = settings.MONGODB_LOG.get(config_item, mongo_db[config_item])
    mongouri = 'mongodb://{user}:{password}@{host}/{db}'.format(**mongo_db)
    error_msg = ''
    try:
        if (mongo_db['user'] and mongo_db['password']):
            mdb = mongoengine.connect(mongo_db['db'], host=mongouri)
        else:
            mdb = mongoengine.connect(mongo_db['db'], host=mongo_db['host'])
    except mongoengine.connection.ConnectionError:
        log.exception('Unable    to    connect    to    mongodb    to    save    log,    please    check    MONGODB_LOG    settings.')
    if (course_id is None):
        if (not request.user.is_staff):
            raise Http404
        cilset = CourseImportLog.objects.order_by('-created')
    else:
        try:
            course = get_course_by_id(course_id)
        except Exception:
            log.info('Cannot    find    course    %s', course_id)
            raise Http404
        if (not (request.user.is_staff or CourseInstructorRole(course.id).has_user(request.user) or CourseStaffRole(course.id).has_user(request.user))):
            raise Http404
        log.debug('course_id=%s', course_id)
        cilset = CourseImportLog.objects.filter(course_id=course_id).order_by('-created')
        log.debug('cilset    length=%s', len(cilset))
    paginator = Paginator(cilset, page_size)
    try:
        logs = paginator.page(request.GET.get('page'))
    except PageNotAnInteger:
        logs = paginator.page(1)
    except EmptyPage:
        given_page = int(request.GET.get('page'))
        page = min(max(1, given_page), paginator.num_pages)
        logs = paginator.page(page)
    mdb.disconnect()
    context = {'logs': logs, 'course_id': (course_id.to_deprecated_string() if course_id else None), 'error_msg': error_msg, 'page_size': page_size}
    return render_to_response(self.template_name, context)
