diff --git a/django/contrib/gis/db/backend/postgis/creation.py b/django/contrib/gis/db/backend/postgis/creation.py index a53ec71d400..113416de382 100644 --- a/django/contrib/gis/db/backend/postgis/creation.py +++ b/django/contrib/gis/db/backend/postgis/creation.py @@ -140,7 +140,10 @@ def create_spatial_db(test=False, verbosity=1, autoclobber=False, interactive=Fa # Closing the connection connection.close() settings.DATABASE_NAME = db_name - settings.DATABASE_SUPPORTS_TRANSACTIONS = connection.creation._rollback_works() + connection.settings_dict["DATABASE_NAME"] = db_name + can_rollback = connection.creation._rollback_works() + settings.DATABASE_SUPPORTS_TRANSACTIONS = can_rollback + connection.settings_dict["DATABASE_SUPPORTS_TRANSACTIONS"] = can_rollback # Syncing the database call_command('syncdb', verbosity=verbosity, interactive=interactive) diff --git a/django/db/backends/creation.py b/django/db/backends/creation.py index c48cad6a7d5..b338a342ef3 100644 --- a/django/db/backends/creation.py +++ b/django/db/backends/creation.py @@ -322,8 +322,9 @@ class BaseDatabaseCreation(object): self.connection.close() settings.DATABASE_NAME = test_database_name self.connection.settings_dict["DATABASE_NAME"] = test_database_name - settings.DATABASE_SUPPORTS_TRANSACTIONS = self._rollback_works() - self.connection.settings_dict["DATABASE_SUPPORTS_TRANSACTIONS"] = self._rollback_works() + can_rollback = self._rollback_works() + settings.DATABASE_SUPPORTS_TRANSACTIONS = can_rollback + self.connection.settings_dict["DATABASE_SUPPORTS_TRANSACTIONS"] = can_rollback call_command('syncdb', verbosity=verbosity, interactive=False)