def post_view(request,id): comments=Comment.objects.filter(post_to=id) comment=CommentForm() post=Post.objects.get(id=id) if request.method=='POST': #Создание коммента if 'cre_comm' in request.POST: comment=CommentForm(request.POST) if comment.is_valid(): comment.create_comm(request,id) return HttpResponseRedirect(reverse('post_view',args=[id,])) #Удаление коммента if 'delete_comment_id' in request.POST: comment_del=Comment.objects.get(id=int(request.POST['delete_comment_id'])) comment_del.delete_comment(id) return render_to_response('post_view.html',{'post':post,'comments':comments,'comment':comment},context_instance=RequestContext(request))