Browse Source

修复bug,获取的数据没有中间表id,无法满足删除功能,现已修复

DYaiu 4 years ago
parent
commit
0dd3747ab5
1 changed files with 5 additions and 1 deletions
  1. 5 1
      treeAndTable/views.py

+ 5 - 1
treeAndTable/views.py

@@ -103,6 +103,7 @@ class DeptAndJobView(ModelViewSet):
 
     '''
     根据部门id获取部门岗位中间表的该部门所有岗位信息
+    返回中间表id和岗位name
     '''
 
     def list(self, request, *args, **kwargs):
@@ -111,5 +112,8 @@ class DeptAndJobView(ModelViewSet):
         deptAndJob = Dept_job.objects.filter(dept_id=deptId).all()
         data = []
         for DJ in deptAndJob:
-            data.append(model_to_dict(DJ.job))
+            data.append({
+                'id': DJ.id,
+                'name': DJ.job.name
+            })
         return Response(data=data, status=status.HTTP_200_OK)