예제 #1
0
def create_message(request):
    if request.method == 'POST':
        form = MemoMessageForm(request.POST)
        if form.is_valid():
            msg = form.save(commit=False)
            msg.content_timestamp = datetime.now()
            msg.save()
            return HttpResponseRedirect(reverse('memo_message_list_all'))
        else:
            return render_to_response('geocamMemo/message_form.html',
                                  dict(form=form),
                                  context_instance=RequestContext(request))
    else:
        form = MemoMessageForm()
        return render_to_response('geocamMemo/message_form.html',
                                  dict(form=form),                                   
                                  context_instance=RequestContext(request))
예제 #2
0
def create_message(request):
    if request.method == 'POST':
        form = MemoMessageForm(request.POST)
        if form.is_valid():
            msg = form.save(commit=False)
            msg.content_timestamp = datetime.now()
            msg.save()
            return HttpResponseRedirect(reverse('memo_message_list_all'))
        else:
            return render_to_response('geocamMemo/message_form.html',
                                      dict(form=form),
                                      context_instance=RequestContext(request))
    else:
        form = MemoMessageForm()
        return render_to_response('geocamMemo/message_form.html',
                                  dict(form=form),
                                  context_instance=RequestContext(request))
예제 #3
0
def create_message(request):
    if request.method == 'POST':
        form = MemoMessageForm(request.POST)
        if form.is_valid():
            msg = form.save(commit=False)
            # Set time manually this way in case we switch back to a versioned message
            # model in the future
            msg.content_timestamp = datetime.now()
            msg.save()
            return HttpResponseRedirect(reverse('memo_message_list_all'))
        else:
            return render_to_response('geocamMemo/message_form.html',
                                      dict(form=form),
                                      context_instance=RequestContext(request))
    else:
        form = MemoMessageForm()
        return render_to_response('geocamMemo/message_form.html',
                                  dict(form=form),
                                  context_instance=RequestContext(request))
예제 #4
0
def create_message(request):
    if request.method == 'POST':
        form = MemoMessageForm(request.POST)
        if form.is_valid():
            msg = form.save(commit=False)
            # Set time manually this way in case we switch back to a versioned message
            # model in the future
            msg.content_timestamp = datetime.now()
            msg.save()
            return HttpResponseRedirect(reverse('memo_message_list_all'))
        else:
            return render_to_response('geocamMemo/message_form.html',
                                  dict(form=form),
                                  context_instance=RequestContext(request))
    else:
        form = MemoMessageForm()
        return render_to_response('geocamMemo/message_form.html',
                                  dict(form=form),
                                  context_instance=RequestContext(request))
예제 #5
0
def create_message(request):
    if request.method == 'POST':
        form = MemoMessageForm(request.POST)
        if form.is_valid():
            msg = form.save(commit=False)
            # Since revisions are now saved to db, this timestamp
            # can't just be auto set since we want to preserve from creation time
            msg.content_timestamp = datetime.now()
            msg.save()
            return HttpResponseRedirect(reverse('memo_message_list_all'))
        else:
            return render_to_response('geocamMemo/message_form.html',
                                      dict(form=form),
                                      context_instance=RequestContext(request))
    else:
        form = MemoMessageForm()
        return render_to_response('geocamMemo/message_form.html',
                                  dict(form=form),
                                  context_instance=RequestContext(request))
예제 #6
0
def create_message(request):
    if request.method == 'POST':
        form = MemoMessageForm(request.POST)
        if form.is_valid():
            msg = form.save(commit=False)
            # Since revisions are now saved to db, this timestamp
            # can't just be auto set since we want to preserve from creation time
            msg.content_timestamp = datetime.now()
            msg.save()
            return HttpResponseRedirect(reverse('memo_message_list_all'))
        else:
            return render_to_response('geocamMemo/message_form.html',
                                  dict(form=form),
                                  context_instance=RequestContext(request))
    else:
        form = MemoMessageForm()
        return render_to_response('geocamMemo/message_form.html',
                                  dict(form=form),                                   
                                  context_instance=RequestContext(request))