def pre_delete_layer(instance, sender, **kwargs):
 if instance.is_remote:
  return
 logger.debug('Going to delete the styles associated for [%s]', instance.typename.encode('utf-8'))
 ct = ContentType.objects.get_for_model(instance)
 OverallRating.objects.filter(content_type=ct, object_id=instance.id).delete()
 default_style = instance.default_style
 for style in instance.styles.all():
  if (style.layer_styles.all().count() == 1):
   if (style != default_style):
    style.delete()
 remove_object_permissions(instance)

def pre_delete_layer ( instance , sender , ** kwargs ) : if instance . is_remote : return logger . debug ( 'Going to delete the styles associated for [%s]' , instance . typename . encode ( 'utf-8' ) ) ct = ContentType . objects . get_for_model ( instance ) OverallRating . objects . filter ( content_type = ct , object_id = instance . id ) . delete ( ) default_style = instance . default_style for style in instance . styles . all ( ) : if ( style . layer_styles . all ( ) . count ( ) == 1 ) : if ( style != default_style ) : style . delete ( ) remove_object_permissions ( instance )
remove any associated style to the layer .