def article_dietail(request,article_id): # print(request.user.userprofile.name,'------------') category = models.Category.objects.filter(set_as_top_menu=True).order_by('position_index') article_obj = models.Article.objects.get(id=article_id) comment_tree = comment_hander.build_tree(article_obj.comment_set.select_related()) tree_html = comment_hander.render_comment_tree(comment_tree) return render(request,'bbs/article_detail.html',{'article_obj':article_obj,'categorys':category,'tree_html':tree_html})
def get_comments(request, article_id): ''' 获取Ajax评论在前端的展示 ''' article_obj = models.Article.objects.get(id=article_id) comment_tree = comment_hander.build_tree( article_obj.comment_set.select_related()) tree_html = comment_hander.render_comment_tree(comment_tree) return HttpResponse(tree_html)
def get_comments(request,article_id): article_obj = models.Article.objects.get(id=article_id) comment_tree = comment_hander.build_tree(article_obj.comment_set.select_related()) tree_html = comment_hander.render_comment_tree(comment_tree) return HttpResponse(tree_html)