golf/views/view_course.py
def createCourseTeeHole(request, courseId, courseTeeId):
    """
    Create function for course tee hole
    """
    try:
        h = Hole.objects.get(number=request.POST['number'], course_id=courseId)
    except Hole.DoesNotExist:
        h = Hole(number=request.POST['number'], name=request.POST['name'], course_id=courseId)
        h.save()
    t = Tee(hole_id=h.id, course_tee_id=courseTeeId, yardage=request.POST['yardage'], par=request.POST['par'], handicap=request.POST['handicap'])
    t.save()
    return JsonResponse({'data' : [{'id':t.id, 'yardage':t.yardage, 'par':t.par, 'handicap':t.handicap, 'name':t.hole.name, 'number':t.hole.number}]})

    Create function for course tee hole
    
Create function for course tee hole
Create function for course tee hole
def createCourseTeeHole(request, courseId, courseTeeId):
    try:
        h = Hole.objects.get(number=request.POST['number'], course_id=courseId)
    except Hole.DoesNotExist:
        h = Hole(number=request.POST['number'], name=request.POST['name'], course_id=courseId)
        h.save()
    t = Tee(hole_id=h.id, course_tee_id=courseTeeId, yardage=request.POST['yardage'], par=request.POST['par'], handicap=request.POST['handicap'])
    t.save()
    return JsonResponse({'data' : [{'id':t.id, 'yardage':t.yardage, 'par':t.par, 'handicap':t.handicap, 'name':t.hole.name, 'number':t.hole.number}]})
def createCourseTeeHole ( request , courseId , courseTeeId ) : try : h = Hole . objects . get ( number = request . POST [ 'number' ] , course_id = courseId ) except Hole . DoesNotExist : h = Hole ( number = request . POST [ 'number' ] , name = request . POST [ 'name' ] , course_id = courseId ) h . save ( ) t = Tee ( hole_id = h . id , course_tee_id = courseTeeId , yardage = request . POST [ 'yardage' ] , par = request . POST [ 'par' ] , handicap = request . POST [ 'handicap' ] ) t . save ( ) return JsonResponse ( { 'data' : [ { 'id' : t . id , 'yardage' : t . yardage , 'par' : t . par , 'handicap' : t . handicap , 'name' : t . hole . name , 'number' : t . hole . number } ] } )
Create function for course tee hole
Create function for course tee hole
"""
    Create function for course tee hole
    """
request
courseId
courseTeeId