HimoolERP/apps/flow/filters.py

27 lines
887 B
Python
Raw Normal View History

2021-11-04 23:49:56 +08:00
from django_filters.rest_framework import FilterSet
from django_filters.filters import *
2021-12-23 00:13:06 +08:00
from apps.flow.models import *
2021-11-04 23:49:56 +08:00
2021-12-23 00:13:06 +08:00
class InventoryFlowFilter(FilterSet):
start_date = DateFilter(field_name='create_time', lookup_expr='gte', label='开始日期')
end_date = DateFilter(field_name='create_time', lookup_expr='lt', label='结束日期')
class Meta:
model = InventoryFlow
fields = ['warehouse', 'goods', 'type', 'creator', 'start_date', 'end_date']
class FinanceFlowFilter(FilterSet):
start_date = DateFilter(field_name='create_time', lookup_expr='gte', label='开始日期')
end_date = DateFilter(field_name='create_time', lookup_expr='lt', label='结束日期')
2021-11-04 23:49:56 +08:00
2021-12-23 00:13:06 +08:00
class Meta:
model = FinanceFlow
fields = ['account', 'type', 'creator', 'start_date', 'end_date']
__all__ = [
'InventoryFlowFilter', 'FinanceFlowFilter',
2021-11-04 23:49:56 +08:00
]