okay adding/removing authors is functional, ordering of it is NQR, also moved to bookstrap margin/padding classes where it worked
This commit is contained in:
13
main.py
13
main.py
@@ -200,7 +200,7 @@ def AddSubs(books):
|
||||
for row in subs:
|
||||
index = next((i for i, item in enumerate(books) if item.id == row.sub_book_id), -1)
|
||||
if index == -1:
|
||||
continue
|
||||
continue
|
||||
books[index].parent_id = row.book_id
|
||||
books[index].sub_book_num = row.sub_book_num
|
||||
|
||||
@@ -361,15 +361,14 @@ def book(id):
|
||||
if "genre-{}".format(genre.id) in request.form:
|
||||
book.genre.append( genre )
|
||||
# set book author (empty list, in form they are in author-0, author-1, ... author-n)
|
||||
# so use while to find them all and append them back to now empty list
|
||||
acnt=0
|
||||
# so use find them all and append them back to now empty list
|
||||
book.author=[]
|
||||
while "author-{}".format( acnt ) in request.form:
|
||||
book.author.append( Author.query.get( request.form["author-{}".format( acnt )] ) )
|
||||
acnt = acnt + 1
|
||||
for el in request.form:
|
||||
if 'author-' in el:
|
||||
book.author.append( Author.query.get( request.form[el] ) )
|
||||
|
||||
## TODO:
|
||||
# what about add/remove author, series?, subbooks?, loan?, etc.
|
||||
# what about series?, subbooks?, loan?, etc.
|
||||
db.session.commit()
|
||||
message="Successfully Updated Book (id={})".format(id)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user