示例#1
0
def save_message(request):
    context = RequestContext(request)

    if request.method == 'POST':
        mi_post = Entrada.objects.get(id=request.POST['id'])
        nombre= request.POST.get('autor')
        msn= request.POST.get('mensaje')
        mail= request.POST.get('mail')      
        postid = request.POST.get('id') 
        mensaje = Comentario()
        mensaje.autor = nombre
        mensaje.mail = mail
        mensaje.mensaje = msn
        mensaje.post = mi_post
        mensaje.save()
    postid = request.POST.get('id')
    mensajes = Comentario.objects.filter(post=postid)

    return render_to_response('comentarios.html', 
                              {'mensajes':mensajes},
                              context)