阅读背景:

Django Rest Framework模型序列化器:将所有字段设置为只读除一个

来源:互联网 

The model that I'm using has a lot of fields. I want to be able to set all the fields to be read only except for one i.e. I want to allow only one particular field to be writable. Is there a shortcut to do this? I'm only aware of using "read_only_fields=('x','y') and I really don't want to type out all the fields especially if I'm going to make changes to the models later. "exclude =" also doesn't apply in this case.The model that I'm using has a lot of fields. I




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: