diff --git a/CHANGES.md b/CHANGES.md index c1b9888..2642919 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,13 @@ Changelog ========= +0.0.6 (Dec 15th 2015) +------------------ + +### Small fix of legacy settings name + +- `DJANGO_FRAGMENTS_SHARD_SETTINGS` to `DJANGO_SHARDING_SETTINGS`. + 0.0.5 (Dec 14th 2015) ------------------ diff --git a/django_sharding/apps.py b/django_sharding/apps.py index 41e3b97..acd544b 100644 --- a/django_sharding/apps.py +++ b/django_sharding/apps.py @@ -13,7 +13,7 @@ class ShardingConfig(AppConfig): name = 'django_sharding' def ready(self): - shard_settings = getattr(settings, 'DJANGO_FRAGMENTS_SHARD_SETTINGS', {}) + shard_settings = getattr(settings, 'DJANGO_SHARDING_SETTINGS', {}) shard_groups = [settings.DATABASES[db_settings]['SHARD_GROUP'] for db_settings in settings.DATABASES] shard_groups = set(filter(lambda group: group is not None, shard_groups)) self.bucketers = {} diff --git a/django_sharding_library/fields.py b/django_sharding_library/fields.py index c8effdf..9649536 100644 --- a/django_sharding_library/fields.py +++ b/django_sharding_library/fields.py @@ -140,7 +140,7 @@ def save_shard(self, model_instance): shard_storage_table = getattr(self, 'django_sharding__shard_storage_table') shard_group = getattr(self, 'django_sharding__shard_group') - app_config_app_label = getattr(settings, 'DJANGO_FRAGMENTS_SHARD_SETTINGS', {}).get('APP_CONFIG_APP', 'django_sharding') + app_config_app_label = getattr(settings, 'DJANGO_SHARDING_SETTINGS', {}).get('APP_CONFIG_APP', 'django_sharding') bucketer = apps.get_app_config(app_config_app_label).get_bucketer(shard_group) shard = bucketer.pick_shard(model_instance) shard_object, _ = shard_storage_table.objects.get_or_create(shard_key=shard_key) diff --git a/django_sharding_library/router.py b/django_sharding_library/router.py index 4db93a5..6417f20 100644 --- a/django_sharding_library/router.py +++ b/django_sharding_library/router.py @@ -22,7 +22,7 @@ def get_shard_for_instance(self, instance): return instance._state.db or instance.get_shard() def get_read_db_routing_strategy(self, shard_group): - app_config_app_label = getattr(settings, 'DJANGO_FRAGMENTS_SHARD_SETTINGS', {}).get('APP_CONFIG_APP', 'django_sharding') + app_config_app_label = getattr(settings, 'DJANGO_SHARDING_SETTINGS', {}).get('APP_CONFIG_APP', 'django_sharding') return apps.get_app_config(app_config_app_label).get_routing_strategy(shard_group) def db_for_read(self, model, **hints): diff --git a/django_sharding_library/signals.py b/django_sharding_library/signals.py index 48e4359..f5f487a 100644 --- a/django_sharding_library/signals.py +++ b/django_sharding_library/signals.py @@ -10,7 +10,7 @@ def save_shard_handler(sender, instance, **kwargs): def shard_handler(sender, instance, **kwargs): save_shard_handler(sender, instance, **kwargs) """ - app_config_app_label = getattr(settings, 'DJANGO_FRAGMENTS_SHARD_SETTINGS', {}).get('APP_CONFIG_APP', 'django_sharding') + app_config_app_label = getattr(settings, 'DJANGO_SHARDING_SETTINGS', {}).get('APP_CONFIG_APP', 'django_sharding') bucketer = apps.get_app_config(app_config_app_label).get_bucketer(sender.django_sharding__shard_group) shard_fields = filter(lambda field: getattr(field, 'django_sharding__stores_shard', False), sender._meta.fields) if not any(shard_fields): diff --git a/setup.py b/setup.py index 5ac9ec2..cc57cab 100755 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -version = '0.0.5' +version = '0.0.6' setup(