正在显示
1 个修改的文件
包含
6 行增加
和
6 行删除
@@ -129,7 +129,7 @@ class AuditProjectsList(ListAPIView): | @@ -129,7 +129,7 @@ class AuditProjectsList(ListAPIView): | ||
129 | queryset = Project.objects.all() | 129 | queryset = Project.objects.all() |
130 | serializer_class = ProjectSerializer | 130 | serializer_class = ProjectSerializer |
131 | pagination_class = MyPageNumberPagination | 131 | pagination_class = MyPageNumberPagination |
132 | - permission_classes = (IsAuthenticated, IsAdminUser) | 132 | + permission_classes = (IsAuthenticated,) |
133 | 133 | ||
134 | def get_queryset(self): | 134 | def get_queryset(self): |
135 | data = Project.objects.filter(auditor__user_id=self.request.user.id).order_by('is_done') | 135 | data = Project.objects.filter(auditor__user_id=self.request.user.id).order_by('is_done') |
@@ -143,7 +143,7 @@ class AuditProjectsList(ListAPIView): | @@ -143,7 +143,7 @@ class AuditProjectsList(ListAPIView): | ||
143 | class CheckAuth(APIView): | 143 | class CheckAuth(APIView): |
144 | """ 检查是否有权限进行审批 """ | 144 | """ 检查是否有权限进行审批 """ |
145 | allowed_methods = ('GET',) | 145 | allowed_methods = ('GET',) |
146 | - permission_classes = (IsAuthenticated, IsAdminUser) | 146 | + permission_classes = (IsAuthenticated, ) |
147 | 147 | ||
148 | @staticmethod | 148 | @staticmethod |
149 | def get(request, *args, **kwargs): | 149 | def get(request, *args, **kwargs): |
@@ -153,7 +153,7 @@ class CheckAuth(APIView): | @@ -153,7 +153,7 @@ class CheckAuth(APIView): | ||
153 | if not project_auditor: | 153 | if not project_auditor: |
154 | return response(False) | 154 | return response(False) |
155 | else: | 155 | else: |
156 | - auditor_res = Result.objects.filter( | ||
157 | - auditor__user_id=request.user.id, | ||
158 | - project__id=kwargs['pk']).values_list('is_accept', flat=True).first() | ||
159 | - return response(False) if auditor_res else response(True) | 156 | + order = Auditor.objects.filter(user_id=request.user.id).values_list('order', flat=True) |
157 | + audit_result = Result.objects.filter(project_id=kwargs['pk'])[order:1] | ||
158 | + return response(False) if audit_result.is_accept else response(True) | ||
159 | + |
-
请 注册 或 登录 后发表评论