File: db_router.py

package info (click to toggle)
pytest-django 4.11.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 604 kB
  • sloc: python: 4,006; makefile: 39; sh: 17
file content (14 lines) | stat: -rw-r--r-- 539 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class DbRouter:
    def db_for_read(self, model, **hints):
        if model._meta.app_label == "app" and model._meta.model_name == "seconditem":
            return "second"
        return None

    def db_for_write(self, model, **hints):
        if model._meta.app_label == "app" and model._meta.model_name == "seconditem":
            return "second"
        return None

    def allow_migrate(self, db, app_label, model_name=None, **hints):
        if app_label == "app" and model_name == "seconditem":
            return db == "second"