filter.py 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. from django_filters import FilterSet
  2. from .models import AsnListModel, AsnDetailModel
  3. class AsnListFilter(FilterSet):
  4. class Meta:
  5. model = AsnListModel
  6. fields = {
  7. "id": ['exact', 'iexact', 'gt', 'gte', 'lt', 'lte', 'isnull', 'in', 'range'],
  8. "asn_code": ['exact', 'iexact', 'contains', 'icontains'],
  9. "asn_status": ['exact', 'iexact', 'gt', 'gte', 'lt', 'lte', 'isnull', 'in', 'range'],
  10. "total_weight": ['exact', 'iexact', 'gt', 'gte', 'lt', 'lte', 'isnull', 'in', 'range'],
  11. "total_volume": ['exact', 'iexact', 'gt', 'gte', 'lt', 'lte', 'isnull', 'in', 'range'],
  12. "total_cost": ['exact', 'iexact', 'gt', 'gte', 'lt', 'lte', 'isnull', 'in', 'range'],
  13. "supplier": ['exact', 'iexact', 'contains', 'icontains'],
  14. "creater": ['exact', 'iexact', 'contains', 'icontains'],
  15. "is_delete": ['exact', 'iexact'],
  16. "create_time": ['exact', 'iexact', 'year', 'month', 'day', 'week_day', 'gt', 'gte', 'lt', 'lte', 'range'],
  17. "update_time": ['exact', 'iexact', 'year', 'month', 'day', 'week_day', 'gt', 'gte', 'lt', 'lte', 'range']
  18. }
  19. class AsnDetailFilter(FilterSet):
  20. class Meta:
  21. model = AsnDetailModel
  22. fields = {
  23. "id": ['exact', 'gt', 'gte', 'lt', 'lte', 'isnull', 'in', 'range'],
  24. "asn_code": ['exact', 'iexact', 'contains', 'icontains'],
  25. "asn_status": ['exact', 'iexact'],
  26. "supplier": ['exact', 'iexact', 'contains', 'icontains'],
  27. "goods_code": ['exact', 'iexact', 'contains', 'icontains'],
  28. "goods_desc": ['exact', 'iexact', 'contains', 'icontains'],
  29. "goods_qty": ['exact', 'iexact', 'gt', 'lt', 'gte', 'lte'],
  30. "goods_actual_qty": ['exact', 'iexact', 'gt', 'lt', 'gte', 'lte'],
  31. "sorted_qty": ['exact', 'iexact', 'gt', 'lt', 'gte', 'lte'],
  32. "goods_shortage_qty": ['exact', 'iexact', 'gt', 'lt', 'gte', 'lte'],
  33. "goods_more_qty": ['exact', 'iexact', 'gt', 'lt', 'gte', 'lte'],
  34. "goods_damage_qty": ['exact', 'iexact', 'gt', 'lt', 'gte', 'lte'],
  35. "goods_weight": ['exact', 'iexact', 'gt', 'gte', 'lt', 'lte', 'isnull', 'in', 'range'],
  36. "goods_volume": ['exact', 'iexact', 'gt', 'gte', 'lt', 'lte', 'isnull', 'in', 'range'],
  37. "goods_cost": ['exact', 'iexact', 'gt', 'gte', 'lt', 'lte', 'isnull', 'in', 'range'],
  38. "creater": ['exact', 'iexact', 'contains', 'icontains'],
  39. "is_delete": ['exact', 'iexact'],
  40. "create_time": ['year', 'month', 'day', 'week_day', 'gt', 'gte', 'lt', 'lte', 'range'],
  41. "update_time": ['year', 'month', 'day', 'week_day', 'gt', 'gte', 'lt', 'lte', 'range']
  42. }