Код: Выделить всё
class ProductFilter(django_filters.FilterSet):
minCost = django_filters.NumberFilter(name="cost", lookup_type='gte')
maxCost = django_filters.NumberFilter(name="cost", lookup_type='lte')
class Meta:
model = Product
fields = ['name', 'minPrice', 'maxPrice', 'manufacturer',]
Код: Выделить всё
class BaseProduct(models.Model):
name = models.CharField(max_length=256)
cost = models.DecimalField(max_digits=10,decimal_places=2)
class FoodProduct(BaseProduct):
farmer = models.CharField(max_length=256)
class ClothingProduct(BaseProduct):
size = models.CharField(max_length=256)
Подробнее здесь: https://stackoverflow.com/questions/266 ... nheritance