视图集代码
class UserTitleViewset(mixins.ListModelMixin, mixins.RetrieveModelMixin, mixins.CreateModelMixin,
mixins.UpdateModelMixin, viewsets.GenericViewSet):
queryset = UserTitleMod.objects.all()
serializer_class = UserTitleSerializer
def update(self, request, *args, **kwargs):
return "ok"
def perform_update(self, serializer):
return "ok"
settings.py
CORS_ALLOW_METHODS = [
'GET',
'POST',
'PUT',
'PATCH',
'DELETE',
'OPTIONS'
]
我已经尝试了很多次,但是仍然无法正常工作。谢谢您的答复。