1 Star 0 Fork 13

玛丽1号/rainbond-console

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
router.py 888 Bytes
一键复制 编辑 原始数据 按行查看 历史
goodrain 提交于 2017-11-29 16:43 . [ADD] init commit for rainbond-ui
class MultiDbRouter(object):
"""
A router to control all database operations on models in the
auth application.
"""
def db_for_read(self, model, **hints):
"""
Attempts to read auth models go to auth_db.
"""
if hasattr(model._meta, 'in_db'):
return model._meta.in_db
return None
def db_for_write(self, model, **hints):
"""
Attempts to write auth models go to auth_db.
"""
if hasattr(model._meta, 'in_db'):
return model._meta.in_db
return None
def allow_migrate(self, db, app_label, model=None, **hints):
"""
Make sure the auth app only appears in the 'auth_db'
database.
"""
if model and model._meta:
if hasattr(model._meta, 'in_db'):
return model._meta.in_db == db
return None
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/mary-no1/rainbond-console.git
git@gitee.com:mary-no1/rainbond-console.git
mary-no1
rainbond-console
rainbond-console
main

搜索帮助