我有以下型号:
Class Category(models.Model):
....
Class CategoryProduct(models.Model):
....
position = models.IntegerField(max_length=3)
class Product(models.Model):
.....
我正在执行以下查询:
return Product.objects.filter(categoryproduct__category=self, active=True) | \
Product.objects.filter(categoryproduct__category__category=self, active=True)
如何获得按categoryproduct\uuuu位置排序的位置
您将有更好的时间将查询与Q object instances进行“连接”
相关问题 更多 >
编程相关推荐