def publishcomment(request): ##使用一个form类 content = request.POST['comment'] blogid = request.POST['blogid'] commentModel = Comment() commentModel.content = content commentModel.blogid_id = blogid commentModel.save() blogModelList = Blog.objects.all() return render(request, 'blogapp/publishblog.html', {'blogModelList': blogModelList})