def has_object_permission()

in tweeter/permissions.py [0:0]


    def has_object_permission(self, request, view, obj):
        if request.method in permissions.SAFE_METHODS:
            # Allow read only permissions to any user
            # to view the tweet
            return True
        else:
            # Check that the request user owns the object
            # being edited
            return obj.user == request.user