在我的產品詳細信息頁面上,我想顯示選定的產品,并在下面顯示我最昂貴的產品。我怎樣才能買到最貴的產品?我試圖讓這樣的工作: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
提交
取消