Skip to content

Commit 2006859

Browse files
authored
Merge pull request #14 from peopledoc/fix-multiple-connections
Fix connections for test envs with multi-db
2 parents 2491e4a + cc6f50c commit 2006859

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

django_readonly_field/apps.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ class Readonly(AppConfig):
77
name = 'django_readonly_field'
88

99
def ready(self):
10-
from django.db import connection
10+
from django.db import connections
1111
from django.db import utils
1212

1313
readonly_compiler_module = "django_readonly_field.compiler"
1414

15-
# Change the current value (this is mostly important for the tests)
16-
connection.ops.compiler_module = readonly_compiler_module
15+
# Change the current values (this is mostly important for the tests)
16+
for c in connections:
17+
connections[c].ops.compiler_module = readonly_compiler_module
1718

1819
original_load_backend = utils.load_backend
1920

0 commit comments

Comments
 (0)