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

Endret søkeoutputen tilbake til normalt.

Den printet midlertidig masse ting for debugging.
This commit is contained in:
Øystein Ingmar Skartsæterhagen 2011-03-06 12:39:29 +00:00
parent bd5d6a4ed1
commit 768a5309ec
2 changed files with 11 additions and 13 deletions

View File

@ -8,13 +8,12 @@ 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 %-30s' format = '%-13s %-10s %-40s %-30s'
for book in books: for book in books:
print book.to_string(False) b_id = book.getid() or ''
#b_id = book.getid() or '' title = cut_str(book.title, 40, '*')
#title = cut_str(book.title, 40, '*') authors = map(lambda p: p.first_name+' '+p.last_name,
#authors = map(lambda p: p.first_name+' '+p.last_name, book.get_authors())
# book.get_authors()) authors_str = cut_str(', '.join(authors), 30, '*')
#authors_str = cut_str(', '.join(authors), 30, '*') print format % (book.isbn, b_id, title, authors_str)
#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.select_related('persons__person','id','alt_titles') basic_query = Book.objects.select_related('persons__person','id','alt_titles')

View File

@ -52,13 +52,12 @@ def remove_duplicates(list):
def search_person_cmd(search_strings, search_description=False): def search_person_cmd(search_strings, search_description=False):
people = search_person(search_strings, search_description) people = search_person(search_strings, search_description)
#format = '%-20s %-10s %-70s' format = '%-20s %-10s %-70s'
for person in people: for person in people:
print person.to_string() name = cut_str(person.first_name+' '+person.last_name, 20)
# name = cut_str(person.first_name+' '+person.last_name, 20) p_id = cut_str(person.id, 10)
# p_id = cut_str(person.id, 10) books = cut_str(', '.join(map(lambda x: x.book.title, person.books.all())), 70)
# books = cut_str(', '.join(map(lambda x: x.book.title, person.books.all())), 70) print format % (name,p_id,books)
# print format % (name,p_id,books)
def search_person(search_strings, search_description=False): def search_person(search_strings, search_description=False):
basic_query=Person.objects.select_related('books__book__alt_titles') basic_query=Person.objects.select_related('books__book__alt_titles')