Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经做到了,只有对象的所有者才能对资源调用 PATCH 命令,但我希望这个用户只能更新这个资源中的某些字段。我可以通过创建另一个资源并更改 hydrate 方法的第一个资源来做到这一点,但这很麻烦。有没有更简单的选择?
您可以将它们标记为只读:
email = fields.CharField(attribute='email', readonly=True)
我观察到这些字段无法设置,但当用户尝试更改它们时,Tastypie 不会引发错误。