diff --git a/ceo/library.py b/ceo/library.py index e86fff9..8066b4a 100644 --- a/ceo/library.py +++ b/ceo/library.py @@ -77,7 +77,7 @@ class Book(SQLObject): if signouts.count() > 0: book += "\nSigned Out: " for s in signouts: - book += s.username + ", " + book += s.username + " (" + s.due_date + "), " book = book.strip(", ") diff --git a/ceo/urwid/library.py b/ceo/urwid/library.py index 9761aaf..df6ea42 100644 --- a/ceo/urwid/library.py +++ b/ceo/urwid/library.py @@ -31,6 +31,7 @@ def search_books(data): """ menu = make_menu([ ("Overdue Books", overdue_books, None), + ("Signed Out Books", outbooks_search, None), ]) push_window(menu, "Book Search") @@ -52,6 +53,24 @@ def overdue_books(data): None +def outbooks_search(data): + """ + Display a list of all books that are signed out. + """ + overdue = lib.Signout.select(lib.Signout.q.indate==None) + + widgets = [] + + for s in overdue: + widgets.append(urwid.AttrWrap(ButtonText(None, s.book, str(s.book)), + None, 'selected')) + widgets.append(urwid.Divider()) + + push_window(urwid.ListBox(widgets)) + + None + + def checkout_book(data): """ Display the book checkout wizard.