1👍
You are using a boolean operator foo==bar
where you should be using an assignment operator foo=bar
.
Don’t do:
book_item = Items.objects.filter(book__name==q)
Instead do:
book_item = Items.objects.filter(book__name=q)
When calling filter you want it to look through all the Items
that have been created and return the Items
that have a Book
that has a name
= (equal)
to q
(or what ever search variable you’re looking for).
Source:stackexchange.com