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