コード例 #1
0
 def book_edit(book_id):
     book = None
     if book_id == 'new':
         book = create_empty_book()
     else:
         book = search_book_by_id(container, book_id)
     return render_template('book-edit.html', book=book)
コード例 #2
0
ファイル: main.py プロジェクト: OneSeven17/HW08Ozon
 def book_edit(id):
     book = None
     if id == 'new':
         book = create_empty_book()
     else:
         book = search_book_by_id(books_list, id)
     return render_template('book-edit.html', book=book)
コード例 #3
0
ファイル: main.py プロジェクト: evgeniychernyshev/ozon
 def book_save(book_id):
     nonlocal container
     title = request.form['title']
     author = request.form['author']
     if book_id == 'new':
         book = create_book(title=title, author=author)
         container = add_book(container, book)
     else:
         book = search_book_by_id(container, book_id)
         pass # TODO сохранить изменеия
     return redirect(url_for('book_details', book_id=book['id']))
コード例 #4
0
 def book_save(book_id):
     nonlocal container
     title = request.form['title']
     author = request.form['author']
     price = request.form['price']
     tags = request.form['tags']
     if book_id == 'new':
         book = create_book(title=title,
                            author=author,
                            price=price,
                            tags=tags)
         container = add_book(container, book)
     else:
         book = search_book_by_id(container, book_id)
         update_book(book,
                     title=title,
                     author=author,
                     price=price,
                     tags=tags)
         # pass  # TODO: сохранить измения
     return redirect(url_for('book_details', book_id=book['id']))
コード例 #5
0
ファイル: main.py プロジェクト: Timmeze/HW_Ozon_edit-save
 def book_details(book_id):
     result = search_book_by_id(container, book_id)
     return render_template('book-details.html', book=result)
コード例 #6
0
ファイル: main.py プロジェクト: OneSeven17/HW08Ozon
 def book_details(id):
     result = search_book_by_id(books_list, id)
     return render_template('book-details.html', book=result)