Commit 37cce170f0a534864dcbf9dfaca6c553a1976994
1 parent
4b98609b
Exists in
master
and in
39 other branches
Moved Trac router to trac app
Showing
3 changed files
with
24 additions
and
24 deletions
Show diff stats
src/colab/custom_settings.py
| @@ -86,7 +86,7 @@ CACHES = { | @@ -86,7 +86,7 @@ CACHES = { | ||
| 86 | } | 86 | } |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | -DATABASE_ROUTERS = ['colab.routers.TracRouter',] | 89 | +DATABASE_ROUTERS = ['proxy.trac.routers.TracRouter',] |
| 90 | 90 | ||
| 91 | INSTALLED_APPS = INSTALLED_APPS + ( | 91 | INSTALLED_APPS = INSTALLED_APPS + ( |
| 92 | # First app to provide AUTH_USER_MODEL to others | 92 | # First app to provide AUTH_USER_MODEL to others |
src/colab/routers.py
| @@ -1,23 +0,0 @@ | @@ -1,23 +0,0 @@ | ||
| 1 | -class TracRouter(object): | ||
| 2 | - def db_for_read(self, model, **hints): | ||
| 3 | - if model._meta.app_label == 'proxy': | ||
| 4 | - return 'trac' | ||
| 5 | - return None | ||
| 6 | - | ||
| 7 | - def db_for_write(self, model, **hints): | ||
| 8 | - if model._meta.app_label == 'proxy': | ||
| 9 | - return 'trac' | ||
| 10 | - return None | ||
| 11 | - | ||
| 12 | - def allow_relation(self, obj1, obj2, **hints): | ||
| 13 | - if obj1._meta.app_label == 'proxy' or \ | ||
| 14 | - obj2._meta.app_label == 'proxy': | ||
| 15 | - return True | ||
| 16 | - return None | ||
| 17 | - | ||
| 18 | - def allow_migrate(self, db, model): | ||
| 19 | - if db == 'trac': | ||
| 20 | - return model._meta.app_label == 'proxy' | ||
| 21 | - elif model._meta.app_label == 'proxy': | ||
| 22 | - False | ||
| 23 | - return None |
| @@ -0,0 +1,23 @@ | @@ -0,0 +1,23 @@ | ||
| 1 | +class TracRouter(object): | ||
| 2 | + def db_for_read(self, model, **hints): | ||
| 3 | + if model._meta.app_label == 'proxy': | ||
| 4 | + return 'trac' | ||
| 5 | + return None | ||
| 6 | + | ||
| 7 | + def db_for_write(self, model, **hints): | ||
| 8 | + if model._meta.app_label == 'proxy': | ||
| 9 | + return 'trac' | ||
| 10 | + return None | ||
| 11 | + | ||
| 12 | + def allow_relation(self, obj1, obj2, **hints): | ||
| 13 | + if obj1._meta.app_label == 'proxy' or \ | ||
| 14 | + obj2._meta.app_label == 'proxy': | ||
| 15 | + return True | ||
| 16 | + return None | ||
| 17 | + | ||
| 18 | + def allow_migrate(self, db, model): | ||
| 19 | + if db == 'trac': | ||
| 20 | + return model._meta.app_label == 'proxy' | ||
| 21 | + elif model._meta.app_label == 'proxy': | ||
| 22 | + False | ||
| 23 | + return None |