在正常的請求/響應週期中訪問時,request.POST和request.GET上的QueryDicts將是不可變的.要得到可變版本,您須要使用QueryDict.copy().或者,使用一個小技巧python
# data == request.GET or request.POST _mutable = data._mutable # set to mutable data._mutable = True # сhange the values you want data['param_name'] = 'new value' # set mutable flag back data._mutable = _mutable