原因是 自从 django-filter2.0之后 将Filter的name字段 更名为 field_name 所以需要这样写:

class GoodsFilter(filters.FilterSet):
pricemin = filters.NumberFilter(field_name="shop_price", lookup_expr='gte')
pricemax = filters.NumberFilter(field_name="shop_price", lookup_expr='lte')

class Meta:
model = Goods
fields = ['pricemin', 'pricemax']
 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
  • 2021-06-16
  • 2022-02-12
  • 2021-09-30
相关资源
相似解决方案