Commit 88291a69 authored by Enrico Zini's avatar Enrico Zini
Browse files

Added project router to prevent projectb from being touched

parent 4026b800
......@@ -185,6 +185,8 @@ LOGGING = {
}
}
DATABASE_ROUTERS = ["projectb.router.DbRouter"]
# New 1.7 test runner, we set it explicitly to silence django's checks
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
......
# coding: utf-8
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
class DbRouter(object):
def db_for_read(self, model, **hints):
if model._meta.app_label == "projectb":
return "projectb"
return None
def db_for_write(self, model, **hints):
if model._meta.app_label == "projectb":
return 'projectb'
return None
def allow_relation(self, obj1, obj2, **hints):
return None
# Also works with Django 1.7 as long as the projectb app has no DB models
def allow_migrate(self, db, *args, **kw):
if db == "projectb":
return False
# From Django 1.8 onwards
#def allow_migrate(self, db, app_label, model_name=None, **hints):
# if db == "projectb" or app_label == "projectb":
# return False
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment