in bookshelf/main.py [0:0]
def add():
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.create(data)
return redirect(url_for('.view', book_id=book['id']))
return render_template('form.html', action='Add', book={})