Added search for books that are signed out.

Book signouts now display due dates.
This commit is contained in:
Michael Gregson 2009-01-28 00:47:45 -05:00
parent 62171f0c26
commit 4c4cf2b411
2 changed files with 20 additions and 1 deletions

View File

@ -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(", ")

View File

@ -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.