예제 #1
0
    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('.')
예제 #2
0
파일: flight.py 프로젝트: citterio/Skylines
    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('.')
예제 #3
0
 def comments_made(self):
     return FlightComment.query().filter_by(user=self.user).count()
예제 #4
0
 def comments_made(self):
     return FlightComment.query().filter_by(user=self.user).count()