Skip to content

Commit 30edccb

Browse files
author
Eve Le Cellier
committed
Fix connections for test envs with multi-db
1 parent ad0347f commit 30edccb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

django_readonly_field/apps.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ 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
19-
2020
def custom_load_backend(*args, **kwargs):
2121
backend = original_load_backend(*args, **kwargs)
2222

0 commit comments

Comments
 (0)