def create_new_comment(): photo_id = request.json['photo_id'] content = request.json['content'] user = request.json['user'] new_comment = Comment(photo_id=photo_id, content=content, username=user) new_comment.save_to_mongo() return jsonify(get_comments(photo_id))
def new_comment(self, username, content, date=datetime.datetime.utcnow()): comment = Comment(photo_id=self.id, content=content, username=self.username, date=date) comment.save_to_mongo()