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")
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")
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
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
def polls_current(request): return render(request, 'polls/current.html', {'poll': Poll.get_current()})
def polls_current(request): return render(request, 'polls/current.html', { 'poll' : Poll.get_current() })