Exemple #1
0
def new_single_message(request, no_hp):
    if request.method == "POST":
        form = ReplyForm(request.POST)
        if form.is_valid():
            message = form.cleaned_data["message"]
            destination = form.cleaned_data["destination"]
            _send_single_sms(destination, message)
            _write_single_log(message)

            return HttpResponseRedirect(reverse("home"))
    else:
        form = ReplyForm(initial={"destination": no_hp})

    return render_to_response(
        "message/new_single_message.html",
        {"form": form, "destination": no_hp},
        context_instance=RequestContext(request),
    )
Exemple #2
0
def new_single_message(request, no_hp):
    if request.method == 'POST':
        form = ReplyForm(request.POST)
        if form.is_valid():
            message = form.cleaned_data["message"]
            destination = form.cleaned_data["destination"]
            _send_single_sms(destination, message)
            _write_single_log(message)

            return HttpResponseRedirect(reverse('home'))
    else:
        form = ReplyForm(initial={'destination': no_hp})

    return render_to_response('message/new_single_message.html', {
        "form": form,
        "destination": no_hp,
    },
                              context_instance=RequestContext(request))
Exemple #3
0
def reply(request, msg_id):
    msg = get_object_or_404(Queue, pk=msg_id)
    if request.method == "POST":
        form = ReplyForm(request.POST)
        if form.is_valid():
            message = form.cleaned_data["message"]
            destination = form.cleaned_data["destination"]
            _send_single_sms(destination, message)
            _write_single_log(message)

            # Modify message
            msg.status = 0  # processed
            msg.resolution = 0  # approved
            msg.save()

            return HttpResponseRedirect(reverse("home"))
    else:
        form = ReplyForm(initial={"destination": msg.sender})

    return render_to_response(
        "message/reply.html", {"msg": msg, "form": form}, context_instance=RequestContext(request)
    )
Exemple #4
0
def reply(request, msg_id):
    msg = get_object_or_404(Queue, pk=msg_id)
    if request.method == 'POST':
        form = ReplyForm(request.POST)
        if form.is_valid():
            message = form.cleaned_data["message"]
            destination = form.cleaned_data["destination"]
            _send_single_sms(destination, message)
            _write_single_log(message)

            # Modify message
            msg.status = 0  #processed
            msg.resolution = 0  #approved
            msg.save()

            return HttpResponseRedirect(reverse('home'))
    else:
        form = ReplyForm(initial={'destination': msg.sender})

    return render_to_response("message/reply.html", {
        "msg": msg,
        "form": form,
    },
                              context_instance=RequestContext(request))