changed port to 8080 - keep it uniform with views.py
This commit is contained in:
parent
6fa69012b7
commit
b24d05e77d
@ -95,8 +95,6 @@ class BookSchema(Schema):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def must_not_be_blank(data):
|
def must_not_be_blank(data):
|
||||||
if not data:
|
if not data:
|
||||||
raise ValidationError('You forgot to write stuff.')
|
raise ValidationError('You forgot to write stuff.')
|
||||||
|
@ -66,7 +66,7 @@ def show_books():
|
|||||||
return redirect((url_for('search_results', query=search.search.data)))
|
return redirect((url_for('search_results', query=search.search.data)))
|
||||||
if search.select.data == 'Category':
|
if search.select.data == 'Category':
|
||||||
return redirect((url_for('search_cat', query=search.search.data)))
|
return redirect((url_for('search_cat', query=search.search.data)))
|
||||||
|
|
||||||
return render_template('show_books.html', books=books, form=search)
|
return render_template('show_books.html', books=books, form=search)
|
||||||
|
|
||||||
@app.route('/scape', methods=['POST', 'GET'])
|
@app.route('/scape', methods=['POST', 'GET'])
|
||||||
@ -148,8 +148,8 @@ def add_book():
|
|||||||
upload_form = UploadForm()
|
upload_form = UploadForm()
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
title = upload_form.title.data
|
title = upload_form.title.data
|
||||||
authors = upload_form.author.data
|
authors = upload_form.author.data
|
||||||
category = upload_form.category.data
|
category = upload_form.category.data
|
||||||
year_published = upload_form.year_published.data
|
year_published = upload_form.year_published.data
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ def get_books():
|
|||||||
@app.route('/api/books/<int:id>', methods=['GET'])
|
@app.route('/api/books/<int:id>', methods=['GET'])
|
||||||
def get_book_by_id(id):
|
def get_book_by_id(id):
|
||||||
book = Book.query.get(id)
|
book = Book.query.get(id)
|
||||||
data, error = book_schema.dump(book)
|
data = book_schema.dump(book)
|
||||||
if not data:
|
if not data:
|
||||||
return jsonify({"message": "Book could not be found."}), 400
|
return jsonify({"message": "Book could not be found."}), 400
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user