Add ModelAdmin.get_deleted_objects() hook
    
    
    
      
      
      
        
I want to increase control over who can delete what objects using the admin interface.
delete_view calls has_delete_permission(), which is fine, but then it calls get_deleted_objects() from django.contrib.admin.util.
This is very hard to override without monkey-patching get_deleted_objects(), because it requires replacing the whole of delete_view just to change one line.
I propose calling a member method get_deleted_objects(), which by default just calls the one from util, to make it easy to override this behaviour.
I've attached a patch without tests, because the existing tests should check that this doesn't break anything.
       
     
   
 
  
    Attachments
    (1)
  
    
      - options.patch
 (1.7 KB
) - added by Chris Wilson 14 years ago.
- Patch to add get_deleted_objects() hook to ModelAdmin
  Download all attachments as:
  .zip
   
 
      
        
        
          Change History
          (11)
        
          
          
  
  
  
    
      | Component: | Uncategorized → contrib.admin | 
    
      | Needs documentation: | set | 
    
      | Needs tests: | set | 
    
      | Triage Stage: | Unreviewed → Accepted | 
    
      | Type: | Uncategorized → New feature | 
  
 
           
          
  
  
  
    
      | Owner: | changed from nobody to Rebecca Smith | 
    
      | Status: | new → assigned | 
  
 
           
          
  
  
  
    
      | Needs documentation: | unset | 
    
      | Needs tests: | unset | 
  
 
           
          
  
  
  
    
      | Summary: | Django Admin delete_view could benefit from extension points → Add ModelAdmin.get_deleted_objects() hook | 
  
 
           
          
  
  
  
    
      | Patch needs improvement: | set | 
  
 
           
          
  
  
  
    
      | Cc: | Rebecca Smith added | 
    
      | Patch needs improvement: | unset | 
  
 
           
          
  
  
  
    
      | Triage Stage: | Accepted → Ready for checkin | 
  
 
           
          
  
  
  
    
      | Patch needs improvement: | set | 
    
      | Triage Stage: | Ready for checkin → Accepted | 
  
 
           
          
  
  
  
    
      | Patch needs improvement: | unset | 
    
      | Triage Stage: | Accepted → Ready for checkin | 
  
 
           
          
  
  
  
    
      | Resolution: | → fixed | 
    
      | Status: | assigned → closed | 
  
 
           
          
         
       
     
        
    
    
Patch to add get_deleted_objects() hook to ModelAdmin