1

当我使用put而不是patch时,成功部分更新了我的资源,我很困惑!

可以作为补丁使用吗?

根据django-tastypie 阅读文档

PUT 请求要求包含整个资源表示。缺少的字段可能会导致错误,或者按默认值填写。

我的开发环境:

django 1.5
django-tastypie 0.9.15

资源代码如下所示:

class UserResource(ModelResource):
    class Meta:
        queryset = User.objects.all()
        resource_name = 'user'
        excludes = ['email', 'password', 'is_active', 'is_staff', 'is_superuser']
        #allowed_methods = ['get']
        # no permissions checks are performed.
        authentication = Authentication()
        authorization = Authorization()
4

0 回答 0