def getCourse(request):
    try:
        courseId=request.GET.get('courseSelection')
        print "course id with team name is: ", courseId
        #fullCourseId=courseId.split(":")
        #print "courseId :", fullCourseId[1]
        #cId=fullCourseId[1]
        #print "Course id : ", cId
        response = httpconnection.getCourse_Connect(courseId)
        print "response status = ", response.status_code
        convertToJson = response.json()
        print "Return Course Json is",convertToJson
        return render_to_response("getCourse.html",{"list":convertToJson})
    except:
        return render_to_response('error.html',{"message": sys.exc_info()[0]})
def getCourse(request):
    try:
        courseId = request.GET.get('courseSelection')
        print "course id with team name is: ", courseId
        #fullCourseId=courseId.split(":")
        #print "courseId :", fullCourseId[1]
        #cId=fullCourseId[1]
        #print "Course id : ", cId
        response = httpconnection.getCourse_Connect(courseId)
        print "response status = ", response.status_code
        convertToJson = response.json()
        print "Return Course Json is", convertToJson
        return render_to_response("getCourse.html", {"list": convertToJson})
    except:
        return render_to_response('error.html', {"message": sys.exc_info()[0]})
def updateCourseHome(request):
    try:
        response = httpconnection.listCategory_Connect()
        print "response status for category= ", response.status_code
        convertToJson1 = response.json()
        print "Return Category Json is",convertToJson1
        courseId=request.GET.get('courseSelection')
        print "course id with team name is: ", courseId
        #fullCourseId=courseId.split(":")
        #print "courseId :", fullCourseId[1]
        #cId=fullCourseId[1]
        #
        #print "Course id : ", cId
        request.session['courseId'] = courseId
        response = httpconnection.getCourse_Connect(courseId)
        print "response status = ", response.status_code
        convertToJson = response.json()
        #print "Return Course Json is",convertToJson
        return render_to_response("updateCourseHome.html",{"list":convertToJson,"categoryName":convertToJson1})
    except:
        return render_to_response('error.html',{"message": sys.exc_info()[0]})
def updateCourseHome(request):
    try:
        response = httpconnection.listCategory_Connect()
        print "response status for category= ", response.status_code
        convertToJson1 = response.json()
        print "Return Category Json is", convertToJson1
        courseId = request.GET.get('courseSelection')
        print "course id with team name is: ", courseId
        #fullCourseId=courseId.split(":")
        #print "courseId :", fullCourseId[1]
        #cId=fullCourseId[1]
        #
        #print "Course id : ", cId
        request.session['courseId'] = courseId
        response = httpconnection.getCourse_Connect(courseId)
        print "response status = ", response.status_code
        convertToJson = response.json()
        #print "Return Course Json is",convertToJson
        return render_to_response("updateCourseHome.html", {
            "list": convertToJson,
            "categoryName": convertToJson1
        })
    except:
        return render_to_response('error.html', {"message": sys.exc_info()[0]})