def add_comment(self, text): if request.identity is None: flash(_('You have to be logged in to post comments!'), 'warning') else: comment = FlightComment() comment.user = request.identity['user'] comment.flight = self.flight comment.text = text redirect('.')
def add_comment(self, text, **kwargs): if request.identity is None: flash(_('You have to be logged in to post comments!'), 'warning') else: text = text.strip() if len(text) == 0: redirect('.') comment = FlightComment() comment.user = request.identity['user'] comment.flight = self.flight comment.text = text create_flight_comment_notifications(comment) redirect('.')
def comments_made(self): return FlightComment.query().filter_by(user=self.user).count()