DRF修改Request物件

Mrload發表於2024-03-21

直接修改是不可行的

AttributeError: property 'data' of 'Request' object has no setter
def do_something(self,request,*args,**kwargs):
  request._mutable = True
  # 此時可以修改
  # ....
  request._mutable = False

相關文章