diff options
Diffstat (limited to 'rest_framework')
| -rw-r--r-- | rest_framework/permissions.py | 12 | 
1 files changed, 10 insertions, 2 deletions
diff --git a/rest_framework/permissions.py b/rest_framework/permissions.py index 91bf5ad6..751f31a7 100644 --- a/rest_framework/permissions.py +++ b/rest_framework/permissions.py @@ -89,8 +89,8 @@ class DjangoModelPermissions(BasePermission):      It ensures that the user is authenticated, and has the appropriate      `add`/`change`/`delete` permissions on the model. -    This permission will only be applied against view classes that -    provide a `.model` attribute, such as the generic class-based views. +    This permission can only be applied against view classes that +    provide a `.model` or `.queryset` attribute.      """      # Map methods into required permission codes. @@ -138,6 +138,14 @@ class DjangoModelPermissions(BasePermission):          return False +class DjangoModelPermissionsOrAnonReadOnly(DjangoModelPermissions): +    """ +    Similar to DjangoModelPermissions, except that anonymous users are +    allowed read-only access. +    """ +    authenticated_users_only = False + +  class TokenHasReadWriteScope(BasePermission):      """      The request is authenticated as a user and the token used has the right scope  | 
