Projects/worblehat-old
Projects
/
worblehat-old
Archived
12
0
Fork 0

Forbedret printing av søkeresultater.

Nå får forfatterne også være med!
This commit is contained in:
Øystein Ingmar Skartsæterhagen 2010-09-27 17:39:35 +00:00
parent b1fa0c6fb6
commit c6a5245ca1
1 changed files with 5 additions and 4 deletions

View File

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