def make_comment(proposal_id, user, **kwargs): comment = Comment( creator=user, proposal=self.proposals[proposal_id], motivation="comment by {}".format(user.username), ) comment.save() VotablePostReactionEvent.new_event_and_create_listeners_and_email_queue_entries( origin_post=self.proposals[proposal_id], reaction_post=comment, )
def save(self, comment, user, commit=True): new_comment_reply = super(CommentReplyForm, self).save(commit=False) new_comment_reply.comment = comment new_comment_reply.creator = user if user.is_authenticated() else None new_comment_reply.save() ## build history new_comment_reply.build_history(editing_user=user) # creates a historical record clone and a VotablePostHistory ## add event VotablePostReactionEvent.new_event_and_create_listeners_and_email_queue_entries( origin_post=comment, reaction_post=new_comment_reply, ) return new_comment_reply
def save(self, comment, user, commit=True): new_comment_reply = super(CommentReplyForm, self).save(commit=False) new_comment_reply.comment = comment new_comment_reply.creator = user if user.is_authenticated() else None new_comment_reply.save() ## build history new_comment_reply.build_history( editing_user=user ) # creates a historical record clone and a VotablePostHistory ## add event VotablePostReactionEvent.new_event_and_create_listeners_and_email_queue_entries( origin_post=comment, reaction_post=new_comment_reply, ) return new_comment_reply