You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.0 KiB
34 lines
1.0 KiB
class SaxMBSRouter:
|
|
route_app_labels = {"SaxMBS"}
|
|
|
|
def db_for_read(self, model, **hints):
|
|
""" Liest Daten aus SaxMBS"""
|
|
if model._meta.app_label in self.route_app_labels:
|
|
return 'saxmbs'
|
|
return 'saxmbs'
|
|
|
|
def db_for_write(self, model, **hints):
|
|
""" In SaxNBS darf nicht geschrieben werden"""
|
|
if model._meta.app_label in self.route_app_labels:
|
|
return None
|
|
return None
|
|
|
|
def allow_relation(self, obj1, obj2, **hints):
|
|
"""
|
|
Allow relations if a model in the auth or contenttypes apps is
|
|
involved.
|
|
"""
|
|
if (
|
|
obj1._meta.app_label in self.route_app_labels
|
|
or obj2._meta.app_label in self.route_app_labels
|
|
):
|
|
return True
|
|
return None
|
|
|
|
def allow_migrate(self, db, app_label, model_name=None, **hints):
|
|
"""
|
|
SaxMBS darf nicht verändert werden
|
|
"""
|
|
if app_label in self.route_app_labels:
|
|
return None
|
|
return None
|
|
|