from rest_framework import permissions


class IsOwnerOrReadOnly(permissions.BasePermission):
    """
    Custom permission to only allow owners of an object to edit it.
    """

    def has_object_permission(self, request, view, obj):
        # Read permissions are allowed to any request,
        # so we'll always allow GET, HEAD or OPTIONS requests.
        if request.method in permissions.SAFE_METHODS:
            return True

        # Write permissions are only allowed to the owner of the snippet.
        return obj.account == request.user
@@ -51,18 +51,8 @@
 wner
-OrReadOnly
 (per
@@ -144,16 +144,24 @@
 ject to 
+view or 
 edit it.
@@ -169,341 +169,135 @@
     
-%22%22%22%0A%0A    def has_object_permission(self, request, view, obj):%0A        # Read permissions are allowed to any request,%0A        # so we'll always allow GET, HEAD or OPTIONS requests.%0A        if request.method in permissions.SAFE_METHODS:%0A            return True%0A%0A        # Write permissions are only allowed to the owner of the snippet.
+Model instances are expected to include an %60owner%60 attribute.%0A    %22%22%22%0A%0A    def has_object_permission(self, request, view, obj):
 %0A   

rewrite base permissions