mirror of
https://github.com/peeringdb/peeringdb.git
synced 2024-05-11 05:55:09 +00:00
23 lines
532 B
Python
23 lines
532 B
Python
class DatabaseRouter(object):
|
|
"""
|
|
A very basic databases router that routes to a different
|
|
read and write db
|
|
"""
|
|
|
|
def db_for_read(self, model, **hints):
|
|
return "read"
|
|
|
|
def db_for_write(self, model, **hints):
|
|
return "default"
|
|
|
|
def allow_relation(self, obj1, obj2, **hints):
|
|
return True
|
|
|
|
def allow_migrate(self, db, app_label, model_name=None, **hints):
|
|
return True
|
|
|
|
|
|
class TestRouter(DatabaseRouter):
|
|
def db_for_read(self, model, **hints):
|
|
return "default"
|