Exemple #1
0
def new_poll_listener(request):
    running_poll = Poll.get_current()

    new_poll = None

    while True:
        time.sleep(1)

        new_poll = Poll.get_current()

        if new_poll != running_poll:
            break

    return HttpResponse(simplejson.dumps({'new_poll': True}),
                        content_type="application/json")
Exemple #2
0
def new_poll_listener(request):
    running_poll = Poll.get_current()
    
    new_poll = None
    
    while True:
        time.sleep(1)
        
        new_poll = Poll.get_current()
        
        if new_poll != running_poll:
            break
    
    return HttpResponse(simplejson.dumps({
        'new_poll'      : True
    }), content_type="application/json")
Exemple #3
0
def telapi_inbound_sms(request):
    running_poll = Poll.get_current()

    if running_poll:
        answers = running_poll.answer_set.all()

        try:
            answer_index = int(request.REQUEST.get('Body')) - 1

            answer = answers[answer_index]

            running_poll.response_set.create(
                mobile_number=request.REQUEST.get('From'), answer=answer)
        except (TypeError, IndexError), e:
            print e
            pass
Exemple #4
0
def telapi_inbound_sms(request):
    running_poll = Poll.get_current()
    
    if running_poll:
        answers = running_poll.answer_set.all()
        
        try:
            answer_index = int(request.REQUEST.get('Body')) - 1
            
            answer = answers[answer_index]
            
            running_poll.response_set.create(
                mobile_number   = request.REQUEST.get('From'),
                answer          = answer
            )
        except (TypeError, IndexError), e:
            print e
            pass
Exemple #5
0
def polls_current(request):
    return render(request, 'polls/current.html', {'poll': Poll.get_current()})
Exemple #6
0
def polls_current(request):
    return render(request, 'polls/current.html', {
        'poll'      : Poll.get_current()
    })