def greeting_job(): # get all schedules now = timezone.now() print("WE MADE IT") start = (now - timedelta(minutes=5)).time() end = (now + timedelta(minutes=5)).time() print("WE MADE IT 2") schedules = Schedule.objects.filter(schedule_time__range=(start, end)).all() # print("WE MADE IT 3") for sche in schedules: twilio_msg.send_msg(sche.owner) print('test')
def greeting_job(): # get all schedules from scheduler.models import Schedule now = timezone.localtime() print(now) print(timezone.localtime()) start = (now - timedelta(seconds=30)).time() end = (now + timedelta(seconds=30)).time() schedules = Schedule.objects.filter(schedule_time__range=(start, end)).all() # for sche in schedules: print('y') x = twilio_msg.send_msg(sche.owner) print(x) print('test')
def post(self, request, format=None): result = twilio_msg.send_msg(request.user) if result.lower() == 'success!': return Response({'result': result}, status=status.HTTP_201_CREATED) return Response({'result': result}, status=status.HTTP_400_BAD_REQUEST)