sql查询如下所示。
选择*从catalogue_productcategory中(category_id = 40)和(product_id = 7)
答案 0 :(得分:0)
实际上我找到了解决方法。
pc = ProductCategory.objects.filter(Q(category_id = 40)和Q(category_id = 44))
答案 1 :(得分:0)
您为他们定义了模型类吗?
class catalogue_productcategory(model.Model):
#define your desire fields
category = model.ForeignKey(Category)
product = model.ForeignKey(Product)
catalogue_productcategory.objects.filter(category__id=40, product__id=7)