def post_delete_layer(instance, sender, **kwargs):
 from geonode.maps.models import MapLayer
 if instance.typename:
  logger.debug('Going to delete associated maplayers for [%s]', instance.typename.encode('utf-8'))
  MapLayer.objects.filter(name=instance.typename, ows_url=instance.ows_url).delete()
 if instance.is_remote:
  return
 if instance.typename:
  logger.debug('Going to delete the default style for [%s]', instance.typename.encode('utf-8'))
 if (instance.default_style and (Layer.objects.filter(default_style__id=instance.default_style.id).count() == 0)):
  instance.default_style.delete()
 try:
  if instance.upload_session:
   for lf in instance.upload_session.layerfile_set.all():
    lf.file.delete()
 except UploadSession.DoesNotExist:
  pass

def post_delete_layer ( instance , sender , ** kwargs ) : from geonode . maps . models import MapLayer if instance . typename : logger . debug ( 'Going to delete associated maplayers for [%s]' , instance . typename . encode ( 'utf-8' ) ) MapLayer . objects . filter ( name = instance . typename , ows_url = instance . ows_url ) . delete ( ) if instance . is_remote : return if instance . typename : logger . debug ( 'Going to delete the default style for [%s]' , instance . typename . encode ( 'utf-8' ) ) if ( instance . default_style and ( Layer . objects . filter ( default_style__id = instance . default_style . id ) . count ( ) == 0 ) ) : instance . default_style . delete ( ) try : if instance . upload_session : for lf in instance . upload_session . layerfile_set . all ( ) : lf . file . delete ( ) except UploadSession . DoesNotExist : pass
removed the layer from any associated map .