summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/creation.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/backends/postgresql/creation.py')
-rw-r--r--django/db/backends/postgresql/creation.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/django/db/backends/postgresql/creation.py b/django/db/backends/postgresql/creation.py
index a609f33fd6..eb8ac3bcf5 100644
--- a/django/db/backends/postgresql/creation.py
+++ b/django/db/backends/postgresql/creation.py
@@ -2,6 +2,7 @@ import sys
from psycopg2 import errorcodes
+from django.core.exceptions import ImproperlyConfigured
from django.db.backends.base.creation import BaseDatabaseCreation
from django.db.backends.utils import strip_quotes
@@ -21,9 +22,11 @@ class DatabaseCreation(BaseDatabaseCreation):
def sql_table_creation_suffix(self):
test_settings = self.connection.settings_dict['TEST']
- assert test_settings['COLLATION'] is None, (
- "PostgreSQL does not support collation setting at database creation time."
- )
+ if test_settings.get('COLLATION') is not None:
+ raise ImproperlyConfigured(
+ 'PostgreSQL does not support collation setting at database '
+ 'creation time.'
+ )
return self._get_database_create_suffix(
encoding=test_settings['CHARSET'],
template=test_settings.get('TEMPLATE'),