Searching for records is also a common operation in business logic methods. This recipe shows you how to find the book by name and category.
Searching for records
Getting ready
This recipe will use the same library.book definition as the Creating new records recipe did previously. We will write the code in a method called find_book(self).
How to do it...
To find the books, you need to perform the following steps:
- Add the find_book method in the library.book model:
def find_book(self): ...
- Write the search domain for your criteria:
domain = [
'|',
...