Пример #1
0
def make(request):
    on = commands.last_command() == commands.ON
    if on:
        return HttpResponseRedirect(reverse("waiting"))

    form = MakeForm()
    if request.method == "POST":
        form = MakeForm(request.POST)
        if form.is_valid():
            twitter = form.cleaned_data["twitter"]
            commands.send_on(twitter)
            return HttpResponseRedirect(reverse("waiting"))

    return direct_to_template(request, "make.html", {"form": form})
Пример #2
0
def waiting(request):
    twitter = commands.last_twitter()
    command = commands.last_command()
    return direct_to_template(request, "waiting.html", {"twitter": twitter, "command": command})
Пример #3
0
def check(request):
    return HttpResponse(commands.last_command())