-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrouter.py.example
35 lines (28 loc) · 902 Bytes
/
router.py.example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from django.conf import settings
class ConversionRouter(object):
def db_for_read(self, model, **hints):
if model._meta.app_label == "conversion":
return "legacy"
return None
def db_for_write(self, model, **hints):
if model._meta.app_label == "conversion":
return "legacy"
return None
def allow_syncdb(self, db, model):
if db == "import_db":
return model._meta.app_label == "conversion"
elif model._meta.app_label == "conversion":
return False
return None
"""
def allow_relation(self, obj1, obj2, **hints):
if obj1._meta.app_label == 'django_site_errors' or obj2._meta.app_label == 'django_site_errors':
return True
return None
def allow_relation(self, obj1, obj2, **hints):
"Allow any relation between two objects in the db pool"
db_list = ('central','django_site_errors')
if obj1 in db_list and obj2 in db_list:
return True
return None
"""