mirror of
				https://github.com/django/django.git
				synced 2025-10-30 09:06:13 +00:00 
			
		
		
		
	- Used selected "databases" instead of django.db.connections. - Made routers in tests.migrations skip migrations on unexpected databases. - Added DiscoverRunnerGetDatabasesTests.assertSkippedDatabases() hook which properly asserts messages about skipped databases.
		
			
				
	
	
		
			15 lines
		
	
	
		
			454 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			454 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| class DefaultOtherRouter:
 | |
|     def allow_migrate(self, db, app_label, model_name=None, **hints):
 | |
|         return db in {'default', 'other'}
 | |
| 
 | |
| 
 | |
| class TestRouter:
 | |
|     def allow_migrate(self, db, app_label, model_name=None, **hints):
 | |
|         """
 | |
|         The Tribble model should be the only one to appear in the 'other' db.
 | |
|         """
 | |
|         if model_name == 'tribble':
 | |
|             return db == 'other'
 | |
|         elif db != 'default':
 | |
|             return False
 |