Need some help in writing a filter query.
I have the following Models:
class Product:
pid
name
class WishList:
user
items = models.ManyToManyFields(Product)
class Stock:
storeid
product = models.ForeignKey(Product)
aisle
segment
I need to :
Get the Current Logged in USER
Get the Products in the User's WishList
Search for those Products in the 'Stock' for a Particular StoreID passed as argument and display them along with their Aisle
This is what I did:
user = request.user
wish_list = get_object_or_404(WishList, user=user)
list_items = wish_list.items.all()
store_stocks = Stock.objects.filter(storeid=(passed StoreID))
list_stocks store_stocks.filter(store_stocks.pid=list_items.pid)
But it doesn't work and I need some help.
I get the Error as:
list_stocks = store_stocks.filter(store_stocks.pid=list_items.pid)
|
SyntaxError: keyword can't be an expression
store_stocks.pidis indeed not a valid parameter name.