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:
parent
c6a5245ca1
commit
35d0a09728
|
@ -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) |
|
||||||
|
|
Reference in New Issue