コード例 #1
0
ファイル: web_app.py プロジェクト: Junliu66/TimeForBook
def create_new_book():
    if request.method == 'GET':
        return render_template('new_book.html')
    else:
        book_name = request.form['book_name']
        user = User.get_by_email(session['email'])

        new_book = Book(user.email, book_name, user._id)
        new_book.save_to_mongo()

        return make_response(user_books(user._id))
コード例 #2
0
 def new_book(self, book_name):
     book = Book(author=self.email, book_name=book_name, author_id=self._id)
     book.save_to_mongo()