|
@@ -1,4 +1,4 @@
|
|
|
-from django.db.models import F, ExpressionWrapper, BooleanField
|
|
|
+from django.db.models import F
|
|
|
from rest_framework import status
|
|
|
from rest_framework.response import Response
|
|
|
from rest_framework.views import APIView
|
|
@@ -34,6 +34,15 @@ class SchoolDeptViews(APIView):
|
|
|
data.pop('_state')
|
|
|
return Response(data=data, status=status.HTTP_200_OK)
|
|
|
|
|
|
+ def put(self, request):
|
|
|
+ data = request.data
|
|
|
+ parent = SchoolDept.objects.get(id=data['id'])
|
|
|
+ parent.name = data['name']
|
|
|
+ parent.save()
|
|
|
+ d = parent.__dict__
|
|
|
+ d.pop('_state')
|
|
|
+ return Response(data=d, status=status.HTTP_200_OK)
|
|
|
+
|
|
|
def delete(self, request):
|
|
|
try:
|
|
|
# 当传递的id值不存在数据库或没有传id值直接捕获异常
|