我有一个有效的GET/tastype(只读)解决方案。在
我已经允许了PUT/PATCH请求并成功地修补了一个记录。在
不过,我希望将修补程序功能限制为(已经)经过身份验证和授权的用户在适当的modelresources上的某些字段。我仍然希望用户能够获得(看到)所有字段。在
哪里是最好的地方(方法?)为了达到这种限制?在
文件:
https://django-tastypie.readthedocs.org/en/latest/interacting.html?highlight=patch#partially-updating-an-existing-resource-patch
Tags:
既然您似乎已经拥有了对用户的授权,您应该能够通过添加到ModelResource中的元类来实现这一点。例如,使用djangauthorization(from tastypie docs):
此示例将为您提供
django.contrib.auth.models.Permission
中定义的操作的用户授权。在我还有来自Tastype Google群组的this。{a3}使用^。以下是Google Groups链接中提供的示例:
^{pr2}$有点晚了,但也许这会对某人有所帮助。在
我的解决方案是重写
update_in_place
并检查传递的数据。在相关问题 更多 >
编程相关推荐