def add_zone_element(request):
    if (request.user.profile.zone is None):
        return HttpResponse("Vous n'êtes pas connecté en tant que gestionnaire de zone", status=403)
    name = request.POST.get('name', None)
    fountain_price = request.POST.get('fountain-price', 0)
    fountain_duration = request.POST.get('fountain-duration', 1)
    kiosk_price = request.POST.get('kiosk-price', 0)
    kiosk_duration = request.POST.get('kiosk-duration', 1)
    indiv_base_price = request.POST.get('indiv-price', 0)
    if ((not is_int(fountain_price)) or (not is_int(fountain_duration)) or (not is_int(kiosk_price)) or (not is_int(kiosk_duration)) or (not is_int(indiv_base_price))):
        return HttpResponse('Impossible, certains champs devraient être des entiers', status=400)
    if (Zone.objects.filter(name=name).first() is not None):
        return HttpResponse("Une zone avec ce nom existe déjà dans l'application, veuillez en choisir un autre", status=400)
    superzone = Zone.objects.filter(name=request.user.profile.zone).first()
    if (superzone is None):
        return HttpResponse("Impossible de trouver la zone gérée pas l'utilisateur", status=400)
    zone = Zone(name=name, superzone=superzone, subzones=[name], fountain_price=fountain_price, fountain_duration=fountain_duration, kiosk_price=kiosk_price, kiosk_duration=kiosk_duration, indiv_base_price=indiv_base_price)
    while (superzone is not None):
        superzone.subzones.append(name)
        superzone.save()
        superzone = superzone.superzone
    log_element(zone, request)
    json_object = {'data': zone.descript(), 'type': 'add', 'table': 'zone'}
    return HttpResponse(json.dumps(json_object), status=200)
def add_zone_element(request):
    if (request.user.profile.zone is None):
        return HttpResponse("Vous n'êtes pas connecté en tant que gestionnaire de zone", status=403)
    name = request.POST.get('name', None)
    fountain_price = request.POST.get('fountain-price', 0)
    fountain_duration = request.POST.get('fountain-duration', 1)
    kiosk_price = request.POST.get('kiosk-price', 0)
    kiosk_duration = request.POST.get('kiosk-duration', 1)
    indiv_base_price = request.POST.get('indiv-price', 0)
    if ((not is_int(fountain_price)) or (not is_int(fountain_duration)) or (not is_int(kiosk_price)) or (not is_int(kiosk_duration)) or (not is_int(indiv_base_price))):
        return HttpResponse('Impossible, certains champs devraient être des entiers', status=400)
    if (Zone.objects.filter(name=name).first() is not None):
        return HttpResponse("Une zone avec ce nom existe déjà dans l'application, veuillez en choisir un autre", status=400)
    superzone = Zone.objects.filter(name=request.user.profile.zone).first()
    if (superzone is None):
        return HttpResponse("Impossible de trouver la zone gérée pas l'utilisateur", status=400)
    zone = Zone(name=name, superzone=superzone, subzones=[name], fountain_price=fountain_price, fountain_duration=fountain_duration, kiosk_price=kiosk_price, kiosk_duration=kiosk_duration, indiv_base_price=indiv_base_price)
    while (superzone is not None):
        superzone.subzones.append(name)
        superzone.save()
        superzone = superzone.superzone
    log_element(zone, request)
    json_object = {'data': zone.descript(), 'type': 'add', 'table': 'zone'}
    return HttpResponse(json.dumps(json_object), status=200)