Open MoniMurray opened 1 year ago
Author is a ForeignKey in the Product model, so has to be searched as an author object rather than as a string dataset. use get_object_or_404 for the author and then use a simple filter.
You have a form which is providing a string to the view
You have a view which is using the string to create a filter
You filter the database by said filter and return the context to display.
Test using print statements throughout at each point of the all_products.
I used Q(authornameicontains=query) in the end, to query the name field in the author model.
As a site user I want to be able to view products by author so that I can select works by the same author
Acceptance Criteria
Tasks