golf/views/view_director.py
def checkForTournamentDuplicate(request):
    """
    Ajax function to check if the tournament already exists
    url: '/golf/checkfortournamentduplicate/'
    """
    tournamentName = request.POST.get('tournamentName')
    try:
        Tournament.objects.get(name=tournamentName)
        resStr = '{"duplicate": true}'
    except Tournament.MultipleObjectsReturned:
        resStr = '{"duplicate": true}'
    except Tournament.DoesNotExist:
        resStr = '{"duplicate": false}'
    return JsonResponse(json.loads(resStr), safe=False)

    Ajax function to check if the tournament already exists
    url: '/golf/checkfortournamentduplicate/'
    
Ajax function to check if the tournament already exists
url: '/golf/checkfortournamentduplicate/'
Ajax function to check if the tournament already exists url : ' / golf / checkfortournamentduplicate / '
def checkForTournamentDuplicate(request):
    tournamentName = request.POST.get('tournamentName')
    try:
        Tournament.objects.get(name=tournamentName)
        resStr = '{"duplicate": true}'
    except Tournament.MultipleObjectsReturned:
        resStr = '{"duplicate": true}'
    except Tournament.DoesNotExist:
        resStr = '{"duplicate": false}'
    return JsonResponse(json.loads(resStr), safe=False)
def checkForTournamentDuplicate ( request ) : tournamentName = request . POST . get ( 'tournamentName' ) try : Tournament . objects . get ( name = tournamentName ) resStr = '{"duplicate": true}' except Tournament . MultipleObjectsReturned : resStr = '{"duplicate": true}' except Tournament . DoesNotExist : resStr = '{"duplicate": false}' return JsonResponse ( json . loads ( resStr ) , safe = False )
Ajax function to check if the tournament already exists
url: '/golf/checkfortournamentduplicate/'
Ajax function to check if the tournament already exists url : ' / golf / checkfortournamentduplicate / '
"""
    Ajax function to check if the tournament already exists
    url: '/golf/checkfortournamentduplicate/'
    """
request