在我的产品详细信息页面上,我想显示选定的产品,并在下面显示我最昂贵的产品。我怎样才能买到最贵的产品?我试图让这样的工作:product_detail_view = get_object_or_404(Product,id=id)most_expensive_products = Product.object.filter(price = ??????????) context { 'product_detail_view': product_detail_view , 'most_expensive_products':most_expensive_products }return render (... )我必须用什么来代替??????????我需要在我的模型中这样做吗?这是我的模型:class Product(models.Model): title = models.CharField(max_length=120) car = models.CharField(max_length=120) tag = TaggableManager() slug = models.SlugField() description = models.TextField(blank=True,null=True) price = models.DecimalField(max_digits=50,decimal_places=2) acitve = models.BooleanField(default=True) timefield = models.DateTimeField(auto_now_add=True,auto_now=False) updated = models.DateTimeField(auto_now_add=False,auto_now=True) hits = models.IntegerField(default=0) image = models.ImageField()
添加回答
举报
0/150
提交
取消
