From 09ba70f9f1844680ac0e0b3a7c38ff7113cbdb02 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Tue, 5 Mar 2013 22:30:55 +0100 Subject: [PATCH] Made transaction management work even before the first SQL query. Thanks Florian again. --- django/db/backends/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) 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: