def add_network_element(request):
    if (request.user.profile.zone is None):
        return HttpResponse("Vous n'êtes pas connecté en tant que gestionnaire de zone", status=403)
    type = request.POST.get('type', None).upper()
    loc = request.POST.get('localization', None)
    state = request.POST.get('state', None).upper()
    name = ((ElementType[type].value + ' ') + loc)
    zone = Zone.objects.filter(name=request.user.profile.zone).first()
    if (zone is None):
        return HttpResponse("Impossible de trouver la zone gérée pas l'utilisateur", status=400)
    element = Element(name=name, type=type, status=state, location=loc, zone=zone)
    log_element(element, request)
    json_object = {'data': element.network_descript(), 'type': 'add', 'table': 'water_element'}
    return HttpResponse(json.dumps(json_object), status=200)
def add_network_element(request):
    if (request.user.profile.zone is None):
        return HttpResponse("Vous n'êtes pas connecté en tant que gestionnaire de zone", status=403)
    type = request.POST.get('type', None).upper()
    loc = request.POST.get('localization', None)
    state = request.POST.get('state', None).upper()
    name = ((ElementType[type].value + ' ') + loc)
    zone = Zone.objects.filter(name=request.user.profile.zone).first()
    if (zone is None):
        return HttpResponse("Impossible de trouver la zone gérée pas l'utilisateur", status=400)
    element = Element(name=name, type=type, status=state, location=loc, zone=zone)
    log_element(element, request)
    json_object = {'data': element.network_descript(), 'type': 'add', 'table': 'water_element'}
    return HttpResponse(json.dumps(json_object), status=200)