Ugly jQuery workaround for Django admin

Javascript

Public Domain

Hides dependent objects in admin deletion warning. Assumes that Thing.object_set.clear() has been called in a pre_delete signal or something.

Download (right click, save as, rename as appropriate)

Embed

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
$(document).ready(function() {  
        // HERE BE DRAGONS
        $('a[href*=/admin/sponsor/sponsor/]') 
            .parent('li')
            .children('ul')
            .children('li')
            .children('a[href*=/admin/holidays/holiday/]')
                .parent('li')
                .hide();
  });