def post(self, request, pk): f = get_object_or_404(Forum, id=pk) comment = Comment(text=request.POST['comment'], owner=request.user, forum=f) comment.save() return redirect(reverse('forums:forum_detail', args=[pk]))
def post(self, request, pk): print("SDLKJJKSDLJSDKDJLSK") f = get_object_or_404(Forum, id=pk) comment_form = CommentForm(request.POST) print(comment_form) print('RP', request.POST['comment']) comment = Comment(text=request.POST['comment'], owner=request.user, forum=f) comment.save() return redirect(reverse_lazy('forum_detail', args=[pk]))
def addPost(message, user, thread): # Pipe through Markdown or whatever at this point comment = Comment() comment.poster = user.member comment.text = message comment.thread = thread # get the number of posts. Order is this comment.order = thread.total_posts comment.save() return buildHTMLPost(comment, user)
def vote(self, request, *args, **kwargs): self.request = request uid, cid, vote = self.fromRequest("uid", "cid", "vote") v = {"uid": uid, "vote": vote} c = Comment.setVote(cid, v).to_json() return HttpResponse(c, content_type="application/json")