修改判题数据库

This commit is contained in:
virusdefender
2015-08-17 12:48:10 +08:00
parent 3f76df3079
commit 537da5d795
18 changed files with 217 additions and 113 deletions

30
oj/db_router.py Normal file
View File

@@ -0,0 +1,30 @@
# coding=utf-8
class DBRouter(object):
def db_for_read(self, model, **hints):
if model._meta.app_label == 'submission':
return 'submission'
return "default"
def db_for_write(self, model, **hints):
if model._meta.app_label == 'submission':
return 'submission'
return "default"
def allow_relation(self, obj1, obj2, **hints):
return True
def allow_migrate(self, db, app_label, model=None, **hints):
if app_label == "submission":
if db == "submission":
r = True
else:
r = False
else:
if db == "default":
r = True
else:
r = False
print db, app_label, r
return r