diff --git a/python23/django/creation.py b/python23/django/creation.py index 6bc3852..afbd140 100644 --- a/python23/django/creation.py +++ b/python23/django/creation.py @@ -47,12 +47,20 @@ def __init__(self, connection): def sql_table_creation_suffix(self): suffix = [] - if self.connection.settings_dict['TEST_CHARSET']: - suffix.append('CHARACTER SET {0}'.format( - self.connection.settings_dict['TEST_CHARSET'])) - if self.connection.settings_dict['TEST_COLLATION']: - suffix.append('COLLATE {0}'.format( - self.connection.settings_dict['TEST_COLLATION'])) + test_dict = self.connection.settings_dict.get('TEST') + + test_charset = self.connection.settings_dict.get('TEST_CHARSET') + if test_dict: + test_charset = test_dict.get('CHARSET') + if test_charset: + suffix.append('CHARACTER SET {0}'.format(test_charset)) + + test_collation = self.connection.settings_dict.get('TEST_COLLATION') + if test_dict: + test_collation = test_dict.get('COLLATION') + if test_collation: + suffix.append('COLLATE {0}'.format(test_collation)) + return ' '.join(suffix) if django.VERSION < (1, 6):