[Update] 修复AssetUserViewSet 使用Option方法时error

pull/3994/head
Bai 5 years ago
parent 6e5e340a25
commit 9341ce9f84

@ -84,12 +84,15 @@ class AssetUserViewSet(CommonApiMixin, BulkModelViewSet):
def get_object(self): def get_object(self):
pk = self.kwargs.get("pk") pk = self.kwargs.get("pk")
if pk is None:
return
queryset = self.get_queryset() queryset = self.get_queryset()
obj = queryset.get(id=pk) obj = queryset.get(id=pk)
return obj return obj
def get_exception_handler(self): def get_exception_handler(self):
def handler(e, context): def handler(e, context):
logger.error(e, exc_info=True)
return Response({"error": str(e)}, status=400) return Response({"error": str(e)}, status=400)
return handler return handler

Loading…
Cancel
Save