Skip to content

Commit

Permalink
[#17] 采购物料
Browse files Browse the repository at this point in the history
[#17] 采购物料
为材料代用和材料执行添加了字段查询功能
  • Loading branch information
eyeeco committed Jan 11, 2018
1 parent 516486e commit 2a03b7c
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Procurement/api/material_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
from Core.utils.pagination import SmallResultsSetPagination
from Procurement.models import MaterialExecution, MaterialExecutionDetail
from Procurement import serializers

from Procurement import filters

# 材料执行表
class MaterialExecutionViewSet(viewsets.ModelViewSet):
pagination_class = SmallResultsSetPagination
queryset = MaterialExecution.objects.all().order_by('-pk')
filter_class = filters.MaterialExcutionFilter

def get_serializer_class(self):
if self.action == 'create':
Expand Down
3 changes: 2 additions & 1 deletion Procurement/api/materialsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
from Procurement.models import MaterialSubApply, MaterialSubApplyItems
from Procurement.models import SubApplyComment
from Procurement import serializers

from Procurement import filters

# 材料代用申请单
class MaterialSubApplyViewSet(viewsets.ModelViewSet):
pagination_class = SmallResultsSetPagination
queryset = MaterialSubApply.objects.all().order_by('-pk')
filter_class = filters.MaterialSubApplyFilter

def get_serializer_class(self):
if self.action == 'list':
Expand Down
7 changes: 6 additions & 1 deletion Procurement/filters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

from .status_change import (StatusChangeFilter, )

from .materialsub import (MaterialSubApplyFilter, )

from .material_excution import (MaterialExcutionFilter, )

__all__ = ['PurchaseOrderFilter', 'BiddingSheetFilter',
'BiddingApplicationFilter', 'SupplyRelationshipFilter',
'StatusChangeFilter', 'ProcurementMaterialFilter']
'StatusChangeFilter', 'ProcurementMaterialFilter',
'MaterialSubApplyFilter', 'MaterialExcutionFilter']
11 changes: 11 additions & 0 deletions Procurement/filters/material_excution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django_filters import rest_framework as filters
from Procurement import models


# 根据代用单编号模糊查询
class MaterialExcutionFilter(filters.FilterSet):
uid = filters.CharFilter(name='uid', lookup_expr='icontains')

class Meta:
model = models.MaterialExecution
fields = ('uid',)
11 changes: 11 additions & 0 deletions Procurement/filters/materialsub.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django_filters import rest_framework as filters
from Procurement import models


# 根据代用单编号模糊查询
class MaterialSubApplyFilter(filters.FilterSet):
uid = filters.CharFilter(name='uid', lookup_expr='icontains')

class Meta:
model = models.MaterialSubApply
fields = ('uid',)

0 comments on commit 2a03b7c

Please sign in to comment.