Skip to content

Commit f67e794

Browse files
committed
Merge pull request #21 from JBKahn/update-settings-name
update settings name
2 parents d627fd6 + 44bf31f commit f67e794

File tree

6 files changed

+12
-5
lines changed

6 files changed

+12
-5
lines changed

CHANGES.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changelog
22
=========
33

4+
0.0.6 (Dec 15th 2015)
5+
------------------
6+
7+
### Small fix of legacy settings name
8+
9+
- `DJANGO_FRAGMENTS_SHARD_SETTINGS` to `DJANGO_SHARDING_SETTINGS`.
10+
411
0.0.5 (Dec 14th 2015)
512
------------------
613

django_sharding/apps.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ShardingConfig(AppConfig):
1313
name = 'django_sharding'
1414

1515
def ready(self):
16-
shard_settings = getattr(settings, 'DJANGO_FRAGMENTS_SHARD_SETTINGS', {})
16+
shard_settings = getattr(settings, 'DJANGO_SHARDING_SETTINGS', {})
1717
shard_groups = [settings.DATABASES[db_settings]['SHARD_GROUP'] for db_settings in settings.DATABASES]
1818
shard_groups = set(filter(lambda group: group is not None, shard_groups))
1919
self.bucketers = {}

django_sharding_library/fields.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def save_shard(self, model_instance):
140140
shard_storage_table = getattr(self, 'django_sharding__shard_storage_table')
141141
shard_group = getattr(self, 'django_sharding__shard_group')
142142

143-
app_config_app_label = getattr(settings, 'DJANGO_FRAGMENTS_SHARD_SETTINGS', {}).get('APP_CONFIG_APP', 'django_sharding')
143+
app_config_app_label = getattr(settings, 'DJANGO_SHARDING_SETTINGS', {}).get('APP_CONFIG_APP', 'django_sharding')
144144
bucketer = apps.get_app_config(app_config_app_label).get_bucketer(shard_group)
145145
shard = bucketer.pick_shard(model_instance)
146146
shard_object, _ = shard_storage_table.objects.get_or_create(shard_key=shard_key)

django_sharding_library/router.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def get_shard_for_instance(self, instance):
2222
return instance._state.db or instance.get_shard()
2323

2424
def get_read_db_routing_strategy(self, shard_group):
25-
app_config_app_label = getattr(settings, 'DJANGO_FRAGMENTS_SHARD_SETTINGS', {}).get('APP_CONFIG_APP', 'django_sharding')
25+
app_config_app_label = getattr(settings, 'DJANGO_SHARDING_SETTINGS', {}).get('APP_CONFIG_APP', 'django_sharding')
2626
return apps.get_app_config(app_config_app_label).get_routing_strategy(shard_group)
2727

2828
def db_for_read(self, model, **hints):

django_sharding_library/signals.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def save_shard_handler(sender, instance, **kwargs):
1010
def shard_handler(sender, instance, **kwargs):
1111
save_shard_handler(sender, instance, **kwargs)
1212
"""
13-
app_config_app_label = getattr(settings, 'DJANGO_FRAGMENTS_SHARD_SETTINGS', {}).get('APP_CONFIG_APP', 'django_sharding')
13+
app_config_app_label = getattr(settings, 'DJANGO_SHARDING_SETTINGS', {}).get('APP_CONFIG_APP', 'django_sharding')
1414
bucketer = apps.get_app_config(app_config_app_label).get_bucketer(sender.django_sharding__shard_group)
1515
shard_fields = filter(lambda field: getattr(field, 'django_sharding__stores_shard', False), sender._meta.fields)
1616
if not any(shard_fields):

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from setuptools import setup, find_packages
22

3-
version = '0.0.5'
3+
version = '0.0.6'
44

55

66
setup(

0 commit comments

Comments
 (0)