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

la på en select_related() til basic_query i search.py. Dette for å sørge for færre spørringer

This commit is contained in:
Øyvind Almelid 2010-09-27 17:57:24 +00:00
parent c6a5245ca1
commit 35d0a09728
1 changed files with 1 additions and 1 deletions

View File

@ -16,7 +16,7 @@ def search_book_cmd(search_strings, search_description=False):
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 basic_query = Book.objects.select_related('person__person','id')
for word in search_strings: for word in search_strings:
basic_query=basic_query.filter(Q(title__icontains=word) | basic_query=basic_query.filter(Q(title__icontains=word) |
Q(subtitle__icontains=word) | Q(subtitle__icontains=word) |