Forbedret printing av søkeresultater.
Nå får forfatterne også være med!
This commit is contained in:
parent
b1fa0c6fb6
commit
c6a5245ca1
|
@ -6,13 +6,14 @@ from util import *
|
||||||
|
|
||||||
def search_book_cmd(search_strings, search_description=False):
|
def search_book_cmd(search_strings, search_description=False):
|
||||||
books = search_book(search_strings, search_description)
|
books = search_book(search_strings, search_description)
|
||||||
format = '%13s %10s %-40s %15s'
|
format = '%-13s %-10s %-40s %-30s'
|
||||||
for book in books:
|
for book in books:
|
||||||
b_id = book.getid() or ''
|
b_id = book.getid() or ''
|
||||||
title = cut_str(book.title, 40)
|
title = cut_str(book.title, 40)
|
||||||
# TODO author
|
authors = map(lambda p: p.first_name+' '+p.last_name,
|
||||||
author = ''
|
book.get_authors())
|
||||||
print format % (book.isbn, b_id, title, author)
|
authors_str = cut_str(', '.join(authors), 30)
|
||||||
|
print format % (book.isbn, b_id, title, authors_str)
|
||||||
|
|
||||||
def search_book(search_strings, search_description=False):
|
def search_book(search_strings, search_description=False):
|
||||||
basic_query = Book.objects
|
basic_query = Book.objects
|
||||||
|
|
Reference in New Issue