in bookshelf/main.py [0:0]
def edit(book_id):
book = firestore.read(book_id)
if request.method == 'POST':
data = request.form.to_dict(flat=True)
# If an image was uploaded, update the data to point to the new image.
image_url = upload_image_file(request.files.get('image'))
if image_url:
data['imageUrl'] = image_url
book = firestore.update(data, book_id)
return redirect(url_for('.view', book_id=book['id']))
return render_template('form.html', action='Edit', book=book)