1
0
Fork 0

Separate out local and remote search results

This commit is contained in:
Mouse Reeve 2020-05-03 12:59:06 -07:00
parent d8934879e9
commit 7fb0a87077
8 changed files with 102 additions and 41 deletions

View file

@ -67,9 +67,9 @@ class ImportItem(models.Model):
def get_book_from_isbn(self):
''' search by isbn '''
search_results = books_manager.search(self.isbn)
if search_results:
return books_manager.get_or_create_book(search_results[0].key)
search_result = books_manager.search(self.isbn, first=True)
if search_result:
return books_manager.get_or_create_book(search_result.key)
def get_book_from_title_author(self):
''' search by title and author '''
@ -77,9 +77,9 @@ class ImportItem(models.Model):
self.data['Title'],
self.data['Author']
)
search_results = books_manager.search(search_term)
if search_results:
return books_manager.get_or_create_book(search_results[0].key)
search_result = books_manager.search(search_term, first=True)
if search_result:
return books_manager.get_or_create_book(search_result.key)
@property
def isbn(self):