Skip to content

Commit

Permalink
Merge pull request #814 from xzzy/master
Browse files Browse the repository at this point in the history
Fix DB Router
  • Loading branch information
xzzy committed Aug 18, 2020
2 parents 1f53729 + 81e34c1 commit 3329b21
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ledger/payments/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,19 @@ class Meta:
managed = False
db_table = 'payments_open_periods'


class OracleFinanceDBRouter(object):

def db_for_read(self, model, **hints):
if model._meta.db_table == 'payments_open_periods' or model._meta.db_table == 'payments_account_codes':
return 'oracle_finance'
return 'default'
return None

def db_for_write(self, model, **hints):
"""
Attempts to write auth and contenttypes models go to auth_db.
"""
return None

# def db_for_read(self, model, **hints):
# if model._meta.app_label == 'oracle_finance':
# return 'oracle_finance'
Expand Down

0 comments on commit 3329b21

Please sign in to comment.