fixed BUG-8, no genres for a sub book addition loses parent details
This commit is contained in:
2
BUGs
2
BUGs
@@ -8,5 +8,3 @@ BUG-6: author,series, etc. do not have explicit ordering like sub-books... sort
|
|||||||
- add/remove authors, and after save they are ordered by author.id, not order of addition (prob. needs book_author_link to have an auth_num)
|
- add/remove authors, and after save they are ordered by author.id, not order of addition (prob. needs book_author_link to have an auth_num)
|
||||||
|
|
||||||
BUG-7: if you remove a series from a book, it won't appear in the series drop-down if it is the first 'missing' book in that series -- either reset the list, or show all series always?
|
BUG-7: if you remove a series from a book, it won't appear in the series drop-down if it is the first 'missing' book in that series -- either reset the list, or show all series always?
|
||||||
|
|
||||||
BUG-8: if you add a sub-book, then fail to validate (say no genre), then it takes you back, you click a genre (BUT it has lost th eparent association), so it adds a book, not a sub-book
|
|
||||||
|
|||||||
9
main.py
9
main.py
@@ -385,6 +385,7 @@ def new_book():
|
|||||||
parent=request.form['add_sub_parent_id']
|
parent=request.form['add_sub_parent_id']
|
||||||
book = Book.query.get(parent)
|
book = Book.query.get(parent)
|
||||||
bb=QuickParentBook()
|
bb=QuickParentBook()
|
||||||
|
bb.parent=[]
|
||||||
bb.parent.append( { 'id': parent, 'title': book.title } )
|
bb.parent.append( { 'id': parent, 'title': book.title } )
|
||||||
form.publisher.default = book.publisher
|
form.publisher.default = book.publisher
|
||||||
form.owned.default = book.owned
|
form.owned.default = book.owned
|
||||||
@@ -418,7 +419,13 @@ def new_book():
|
|||||||
message = "{}<br>genre=book has to have a genre selected".format( message )
|
message = "{}<br>genre=book has to have a genre selected".format( message )
|
||||||
print( "ERROR: Failed to create book: {}".format(message) )
|
print( "ERROR: Failed to create book: {}".format(message) )
|
||||||
book = Book( title=request.form["title"], owned=request.form['owned'], covertype=request.form['covertype'], condition=request.form['condition'], publisher=request.form['publisher'], year_published=request.form['year_published'], rating=request.form['rating'], notes=request.form['notes'], blurb=request.form['blurb'], genre=book_genres, author=book_authors )
|
book = Book( title=request.form["title"], owned=request.form['owned'], covertype=request.form['covertype'], condition=request.form['condition'], publisher=request.form['publisher'], year_published=request.form['year_published'], rating=request.form['rating'], notes=request.form['notes'], blurb=request.form['blurb'], genre=book_genres, author=book_authors )
|
||||||
return render_template("book.html", page_title=page_title, b=None, books=book, book_form=form, author_list=author_list, genre_list=genre_list, alert=alert, message=message, poss_series_list=ListOfSeriesWithMissingBooks() )
|
if 'parent_id' in request.form:
|
||||||
|
bb=QuickParentBook()
|
||||||
|
bb.parent=[]
|
||||||
|
bb.parent.append( { 'id': request.form['parent_id'], 'title': request.form['parent_title'] } )
|
||||||
|
else:
|
||||||
|
bb=None
|
||||||
|
return render_template("book.html", page_title=page_title, b=bb, books=book, book_form=form, author_list=author_list, genre_list=genre_list, alert=alert, message=message, poss_series_list=ListOfSeriesWithMissingBooks() )
|
||||||
else:
|
else:
|
||||||
return render_template("book.html", page_title=page_title, b=None, books=None, book_form=form, author_list=author_list, genre_list=genre_list, alert="success", message="", poss_series_list=ListOfSeriesWithMissingBooks() )
|
return render_template("book.html", page_title=page_title, b=None, books=None, book_form=form, author_list=author_list, genre_list=genre_list, alert="success", message="", poss_series_list=ListOfSeriesWithMissingBooks() )
|
||||||
|
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ function AddAuthorToBook(num) {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" name="parent_id" value="{{b.parent[0].id}}">
|
<input type="hidden" name="parent_id" value="{{b.parent[0].id}}">
|
||||||
|
<input type="hidden" name="parent_title" value="{{b.parent[0].title}}">
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for key in keys %}
|
{% for key in keys %}
|
||||||
|
|||||||
Reference in New Issue
Block a user