-2
有一個產品目錄,產品有屬性...想過濾產品的屬性。Django - 通過參數過濾對象
class Product(models.Model):
name = models.CharField(verbose_name="Название",max_length=255)
description = models.TextField(verbose_name="Описание")
category = models.ManyToManyField(Category,verbose_name=("Категория"))
class Product_Attribute(models.Model):
product = models.ForeignKey(Product)
option = models.ForeignKey(Attribute_Option)
value = models.CharField(verbose_name=("Value"), max_length=255)
class Attribute_Option(models.Model):
description = models.CharField(verbose_name=("Description"), max_length=100)
name = models.SlugField(verbose_name=("Attribute name"), max_length=100)
我要篩選兩個或更多屬性