Beispiel #1
0
def createNewMessage(request):
    if request.method == 'POST':
        form = NewMessageForm(request.POST)
        if form.is_valid():
            message_frequency = request.POST['message_frequency']
            message_form = form.save(commit = False)
            
            if (message_frequency == "once"):
                message_form.active = False
                sendMessage()
                request.POST['active']
            elif (message_frequency == "specify"):
                message_form.active = True
            else:
                #Message would start sending the following day and frequency would be added there of
                message_form.active = True
                message_form.start_at_date = message_form.start_at_date + datetime.timedelta(days=1)
                       
            message_form.save()
            return HttpResponseRedirect("/project/")
    else:
        form = NewMessageForm()
    
    return render_to_response('createNewMessage.html',{'newMessageForm': form})
Beispiel #2
0
 def job(self):
         # This will be executed every 5 minutes
         sendMessage()