              # add, change, delete built in to django
          )
  
  class ObjectPermissionInstanceView(generics.RetrieveUpdateDestroyAPIView):
      model = BasicModel
      authentication_classes = [authentication.BasicAuthentication]
      permission_classes = [permissions.DjangoObjectLevelModelPermissions]
  
  
  object_permissions_view = ObjectPermissionInstanceView.as_view()
 
</s> remove             ('read_basicpermmodel', "Can view basic perm model"),
 </s> add             ('read_basicpermmodel', 'Can view basic perm model'), </s> remove             read = "read_basicpermmodel"
            write = "change_basicpermmodel"
            delete = "delete_basicpermmodel"
            app_label = 'tests.'
            # model level permissions
            assign_perm(app_label + delete, full_access, obj=model)
            (assign_perm(app_label + write, user, obj=model) for user in (writer, full_access))
            (assign_perm(app_label + read, user, obj=model) for user in (reader, writer, full_access))
 </s> add             model = BasicPermModel.objects.create(text='foo')
            
            assign_perm(perms['read'], readers, model)
            assign_perm(perms['change'], writers, model)
            assign_perm(perms['delete'], deleters, model)

            readers.user_set.add(users['fullaccess'], users['readonly'])
            writers.user_set.add(users['fullaccess'], users['writeonly'])
            deleters.user_set.add(users['fullaccess'], users['deleteonly'])

            self.credentials = {}
            for user in users.values():
                self.credentials[user.username] = basic_auth_header(user.username, 'password')

        # Delete
        def test_can_delete_permissions(self):
            request = factory.delete('/1', HTTP_AUTHORIZATION=self.credentials['deleteonly'])
            object_permissions_view.cls.action = 'destroy'
            response = object_permissions_view(request, pk='1')
            self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT) </s> remove             # assign permissions appropriately
            from guardian.shortcuts import assign_perm
 </s> add             # appropriate object level permissions
            readers = Group.objects.create(name='readers')
            writers = Group.objects.create(name='writers')
            deleters = Group.objects.create(name='deleters') </s> remove             self.no_permission_credentials = basic_auth_header('no_permission', 'password')
            self.reader_credentials = basic_auth_header('reader', 'password')
            self.writer_credentials = basic_auth_header('writer', 'password')
            self.full_access_credentials = basic_auth_header('full_access', 'password')
 </s> add         # Update
        def test_can_update_permissions(self):
            request = factory.patch('/1', {'text': 'foobar'}, format='json',
                HTTP_AUTHORIZATION=self.credentials['writeonly'])
            object_permissions_view.cls.action = 'partial_update'
            response = object_permissions_view(request, pk='1')
            self.assertEqual(response.status_code, status.HTTP_200_OK)
            self.assertEqual(response.data.get('text'), 'foobar')
    model = BasicPermModel
              # add, change, delete built in to django
          )
  
  class ObjectPermissionInstanceView(generics.RetrieveUpdateDestroyAPIView):
    model = BasicPermModel
      authentication_classes = [authentication.BasicAuthentication]
      permission_classes = [permissions.DjangoObjectLevelModelPermissions]
  
  
  object_permissions_view = ObjectPermissionInstanceView.as_view()
keep keep keep keep replace keep keep keep keep keep
 first pass at object level permissions and tests 
rest_framework/tests/test_permissions.py