def post(self,request,num): # post here posts a comment on a given abstract # abstracts themselves should not be modified at all abstr = Abstract.objects.get(pk=num) commentForm = CommentForm(request.POST) if commentForm.is_valid(): comment = Comment(abstract=abstr,author=request.user, content=request.POST["content"],rating=request.POST["rating"]) comment.save() return redirect('/admin/abstracts/%s' % (num,)) else: return self.simpleResponse(request,num,commentForm)
def insertComment(self,num): for i in range(num): com = Comment(abstract=self.testAbs,author=self.user, content=self.fake.sentence(),rating=4) com.save()