This commit is contained in:
caoqianming 2020-12-30 17:56:14 +08:00
parent a960ee6a88
commit 93f86dfdf7
1 changed files with 5 additions and 5 deletions

View File

@ -25,8 +25,8 @@ class RecordMixin():
`request.user` or `request.auth` is accessed. `request.user` or `request.auth` is accessed.
""" """
user = request.user user = request.user
if request.method == 'GET': # if request.method == 'GET':
print(json.dumps(request.query_params), request.method, request.path) # print(json.dumps(request.query_params), request.method, request.path)
class CMAViewSet(RecordMixin, ModelViewSet): class CMAViewSet(RecordMixin, ModelViewSet):
""" """
@ -39,7 +39,7 @@ class CMAViewSet(RecordMixin, ModelViewSet):
search_fields = ['bzbh', 'bzmc', 'sszx', 'xmmc', 'glzz', 'dlmc'] search_fields = ['bzbh', 'bzmc', 'sszx', 'xmmc', 'glzz', 'dlmc']
filterset_fields = ['sszx', 'type', 'glzz'] filterset_fields = ['sszx', 'type', 'glzz']
ordering_fields = ['sszx', 'dlxh', 'lbxh', 'xmxh'] ordering_fields = ['sszx', 'dlxh', 'lbxh', 'xmxh']
ordering = ['create_time'] ordering = ['create_time', 'xmxh']
@action(methods=['get'], detail=False,url_name='cma_group_by', perms_map = {'*':'*'}) @action(methods=['get'], detail=False,url_name='cma_group_by', perms_map = {'*':'*'})
def group(self, request, pk=None): def group(self, request, pk=None):
@ -222,7 +222,7 @@ class QualificationotherViewSet(PageOrNot,ModelViewSet):
class InspectionViewSet(ModelViewSet): class InspectionViewSet(ModelViewSet):
""" """
CNAS检测能力增删改查 检验能力增删改查
""" """
perms_map = {'get': '*', 'post': 'inspection_create', perms_map = {'get': '*', 'post': 'inspection_create',
'put': 'inspection_update', 'delete': 'inspection_delete'} 'put': 'inspection_update', 'delete': 'inspection_delete'}
@ -230,7 +230,7 @@ class InspectionViewSet(ModelViewSet):
serializer_class = InspectionSerializer serializer_class = InspectionSerializer
search_fields = ['dlmc', 'jydx', 'dxxh','jyxmmc','jybz','sszx','sm'] search_fields = ['dlmc', 'jydx', 'dxxh','jyxmmc','jybz','sszx','sm']
ordering_fields = ['dlmc'] ordering_fields = ['dlmc']
ordering = ['create_time'] ordering = ['create_time', 'xmxh']
filterset_fields = ['sszx'] filterset_fields = ['sszx']
@action(methods=['post'], detail=False, url_path='deletes', url_name='inspection_deletes', perms_map = {'post':'inspection_deletes'}) @action(methods=['post'], detail=False, url_path='deletes', url_name='inspection_deletes', perms_map = {'post':'inspection_deletes'})
def deletes(self, request): def deletes(self, request):