def configure_models(instance, sender, **kwargs):
 if (DYNAMIC_DATASTORE not in settings.DATABASES):
  return
 base_file = instance.get_base_file()[0]
 if ((base_file is None) or (base_file.name != u'shp')):
  return
 filename = base_file.file.path
 mapping = file2pgtable(filename, instance.name)
 (model_description, __) = ModelDescription.objects.get_or_create(name=instance.name)
 generate_model(model_description, mapping, db_key=DYNAMIC_DATASTORE)
 TheModel = model_description.get_django_model()
 if (not has_datastore):
  lm = LayerMapping(TheModel, filename, mapping, encoding=instance.charset, using=DYNAMIC_DATASTORE, transform=None)
  lm.save()
 else:
  post_save_layer(instance, sender, **kwargs)

def configure_models ( instance , sender , ** kwargs ) : if ( DYNAMIC_DATASTORE not in settings . DATABASES ) : return base_file = instance . get_base_file ( ) [ 0 ] if ( ( base_file is None ) or ( base_file . name != u'shp' ) ) : return filename = base_file . file . path mapping = file2pgtable ( filename , instance . name ) ( model_description , __ ) = ModelDescription . objects . get_or_create ( name = instance . name ) generate_model ( model_description , mapping , db_key = DYNAMIC_DATASTORE ) TheModel = model_description . get_django_model ( ) if ( not has_datastore ) : lm = LayerMapping ( TheModel , filename , mapping , encoding = instance . charset , using = DYNAMIC_DATASTORE , transform = None ) lm . save ( ) else : post_save_layer ( instance , sender , ** kwargs )
save to postgis if there is a datastore .