0
我有兩個型號Django模型過濾多對多
class Market(Model):
title=models.Charfield()
class Product(Model):
title=Models.Charfield()
markets=ManyToMany(Market)
而且我想在我看來,產品清單。我想爲每個市場獲得一種產品。 怎麼辦?
product_for_each_market_list=Products.objects.filter()# should be rather simple.. but i can't figure what to do
謝謝。
只是一個提示'market.product_set.all()[0]'。 – aisbaa 2012-07-13 08:18:29
是否可以通過查詢產品來獲取我想要的內容? – Feanor 2012-07-13 08:22:09
你可以在sql中顯示查詢嗎? – aisbaa 2012-07-13 10:05:56