def enviar_comentarios(request): context = RequestContext(request) if request.method=="POST": nick = request.POST["nombre"] contenido = request.POST["message"] entrada = Entrada.objects.get(id=request.POST['id']) comentario=Comentario() comentario.nick = nick comentario.contenido = contenido comentario.post = entrada comentario.save() comentarios = Comentario.objects.filter(post=request.POST['id']) return render_to_response('comentarios.html', {'comentarios':comentarios}, context)
def ver_post(request, id_post): context = RequestContext(request) post = Entrada.objects.get(id=id_post) if request.method=="POST": nick = request.POST["nombre"] contenido = request.POST["message"] entrada = Entrada.objects.get(id=id_post) comentario=Comentario() comentario.nick = nick comentario.contenido = contenido comentario.post = entrada comentario.save() comentarios = Comentario.objects.filter(post=id_post) return render_to_response('post.html', {'post':post, 'comentarios':comentarios}, context)