Beispiel #1
0
def add_reminder(request):
    form = RemindForm(request.POST)
    if form.is_valid():
        id = request.POST.get('id', None)
        if id:
            alert = geoalert.edit_alert(request, request.POST.get('id'), form, request.POST['address'])
        else: 
            alert = geoalert.add_alert(request, form, address=request.POST['address'])
        return HttpResponse(simplejson.dumps(dict(id=alert.id)), mimetype="application/json")
    else:
        return HttpResponseBadRequest(simplejson.dumps(form.errors), mimetype="application/json")
Beispiel #2
0
def add_reminder(request):
    """
        Añade o edita una alerta
        Parametros en POST:
            eventid: el id del evento a editar (opcional)
            address: direccion
    """
    form = RemindForm(request.POST)
    address = request.POST.get('address', None)
    if form.is_valid():
        eventid = request.POST.get('eventid', None)
        if eventid:
            alert = geoalert.edit_alert(request, eventid, form, address)
        else: 
            alert = geoalert.add_alert(request, form, address=address)
        return HttpResponse(simplejson.dumps(dict(id=alert.id)), mimetype="application/json")
    else:
        return HttpResponseBadRequest(simplejson.dumps(form.errors), mimetype="application/json")
Beispiel #3
0
def add_reminder(request):
    """
        Añade o edita una alerta
        Parametros en POST:
            eventid: el id del evento a editar (opcional)
            address: direccion
    """
    form = RemindForm(request.POST)
    address = request.POST.get('address', None)
    if form.is_valid():
        eventid = request.POST.get('eventid', None)
        if eventid:
            alert = geoalert.edit_alert(request, eventid, form, address)
        else:
            alert = geoalert.add_alert(request, form, address=address)
        return HttpResponse(simplejson.dumps(dict(id=alert.id)),
                            mimetype="application/json")
    else:
        return HttpResponseBadRequest(simplejson.dumps(form.errors),
                                      mimetype="application/json")