summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/db/backends/__init__.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py
index 346d10198d..68551aad51 100644
--- a/django/db/backends/__init__.py
+++ b/django/db/backends/__init__.py
@@ -269,6 +269,8 @@ class BaseDatabaseWrapper(object):
"""
self.validate_no_atomic_block()
+ self.ensure_connection()
+
self.transaction_state.append(managed)
if not managed and self.is_dirty() and not forced:
@@ -286,6 +288,8 @@ class BaseDatabaseWrapper(object):
"""
self.validate_no_atomic_block()
+ self.ensure_connection()
+
if self.transaction_state:
del self.transaction_state[-1]
else: