File tree 1 file changed +11
-6
lines changed
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -351,11 +351,12 @@ def _swap_database(self, query):
351
351
"""Swap database for query if swappable. Return **new query**
352
352
with swapped database.
353
353
354
- Check manager database and model database match. If model
355
- database is `auto`, manager's one will be used.
354
+ This is experimental feature which allows us to have multiple
355
+ managers configured against different databases for single model
356
+ definition.
356
357
357
- If query database can't be swapped and differs from manager's
358
- database, it's **WRONG AND DANGEROUS**, so assertion is raised.
358
+ The essential limitation though is that database backend have
359
+ to be **the same type** for model and manager!
359
360
"""
360
361
if query .database == self .database :
361
362
return query
@@ -376,8 +377,12 @@ def _swap_database(self, query):
376
377
query .database = self .database
377
378
return query
378
379
else :
379
- assert False , ("Error, models's database and manager's "
380
- "database are different: %s" % model )
380
+ assert False , (
381
+ "Error, query's database and manager's database are "
382
+ "different. Query: %s Manager: %s" % (
383
+ query .database , self .database
384
+ )
385
+ )
381
386
382
387
@staticmethod
383
388
def _subclassed (base , * classes ):
You can’t perform that action at this time.
0 commit comments