1002,1025c1002,1016
<             perform_delete = True
<             
<             if cls._meta.managed == False:
<                 check_view = "select count(TABLE_NAME) from INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = '%s';" % cls._meta.db_table
<                 cursor = connection.cursor()
<                 cursor.execute(check_view, [])
<                 if not cursor.rowcount == 0:
<                     perform_delete = False
<                 
<             if perform_delete:  
<                 pk_list = [pk for pk,instance in items]
<                 del_query = sql.DeleteQuery(cls, connection)
<                 del_query.delete_batch(pk_list)
<     
<                 # Last cleanup; set NULLs where there once was a reference to the
<                 # object, NULL the primary key of the found objects, and perform
<                 # post-notification.
<                 for pk_val, instance in items:
<                     for field in cls._meta.fields:
<                         if field.rel and field.null and field.rel.to in seen_objs:
<                             setattr(instance, field.attname, None)
<     
<                     signals.post_delete.send(sender=cls, instance=instance)
<                     setattr(instance, cls._meta.pk.attname, None)
---
> 
>             pk_list = [pk for pk,instance in items]
>             del_query = sql.DeleteQuery(cls, connection)
>             del_query.delete_batch(pk_list)
> 
>             # Last cleanup; set NULLs where there once was a reference to the
>             # object, NULL the primary key of the found objects, and perform
>             # post-notification.
>             for pk_val, instance in items:
>                 for field in cls._meta.fields:
>                     if field.rel and field.null and field.rel.to in seen_objs:
>                         setattr(instance, field.attname, None)
> 
>                 signals.post_delete.send(sender=cls, instance=instance)
>                 setattr(instance, cls._meta.pk.attname, None)
