Endret søkeoutputen tilbake til normalt.
Den printet midlertidig masse ting for debugging.
This commit is contained in:
parent
bd5d6a4ed1
commit
768a5309ec
|
@ -8,13 +8,12 @@ def search_book_cmd(search_strings, search_description=False):
|
|||
books = search_book(search_strings, search_description)
|
||||
format = '%-13s %-10s %-40s %-30s'
|
||||
for book in books:
|
||||
print book.to_string(False)
|
||||
#b_id = book.getid() or ''
|
||||
#title = cut_str(book.title, 40, '*')
|
||||
#authors = map(lambda p: p.first_name+' '+p.last_name,
|
||||
# book.get_authors())
|
||||
#authors_str = cut_str(', '.join(authors), 30, '*')
|
||||
#print format % (book.isbn, b_id, title, authors_str)
|
||||
b_id = book.getid() or ''
|
||||
title = cut_str(book.title, 40, '*')
|
||||
authors = map(lambda p: p.first_name+' '+p.last_name,
|
||||
book.get_authors())
|
||||
authors_str = cut_str(', '.join(authors), 30, '*')
|
||||
print format % (book.isbn, b_id, title, authors_str)
|
||||
|
||||
def search_book(search_strings, search_description=False):
|
||||
basic_query = Book.objects.select_related('persons__person','id','alt_titles')
|
||||
|
|
|
@ -52,13 +52,12 @@ def remove_duplicates(list):
|
|||
|
||||
def search_person_cmd(search_strings, search_description=False):
|
||||
people = search_person(search_strings, search_description)
|
||||
#format = '%-20s %-10s %-70s'
|
||||
format = '%-20s %-10s %-70s'
|
||||
for person in people:
|
||||
print person.to_string()
|
||||
# name = cut_str(person.first_name+' '+person.last_name, 20)
|
||||
# p_id = cut_str(person.id, 10)
|
||||
# books = cut_str(', '.join(map(lambda x: x.book.title, person.books.all())), 70)
|
||||
# print format % (name,p_id,books)
|
||||
name = cut_str(person.first_name+' '+person.last_name, 20)
|
||||
p_id = cut_str(person.id, 10)
|
||||
books = cut_str(', '.join(map(lambda x: x.book.title, person.books.all())), 70)
|
||||
print format % (name,p_id,books)
|
||||
|
||||
def search_person(search_strings, search_description=False):
|
||||
basic_query=Person.objects.select_related('books__book__alt_titles')
|
||||
|
|
Reference in New Issue