feat(spip): connecte la db spip

wip_revisions
François Poulain 2 years ago
parent a69c9d2549
commit 0e08c4446e
  1. 6
      drupal2spip_lal/base/routers.py
  2. 4
      drupal2spip_lal/settings/base.py

@ -2,6 +2,8 @@ class Drupal2SPIPRouter:
def db_for_read(self, model, **hints):
if model._meta.app_label == 'drupal':
return 'drupal'
if model._meta.app_label == 'spip':
return 'spip'
return None
def db_for_write(self, model, **hints):
@ -12,7 +14,7 @@ class Drupal2SPIPRouter:
We disallow cross db relations.
"""
app1, app2 = obj1._meta.app_label, obj2._meta.app_label
if 'drupal' in [app1, app2]:
if 'drupal' in [app1, app2] or 'spip' in [app1, app2]:
return app1 == app2
return None
@ -20,6 +22,6 @@ class Drupal2SPIPRouter:
"""
We disallow migrations for those db.
"""
if db == 'drupal':
if db in ['drupal', 'spip']:
return False
return None

@ -60,6 +60,10 @@ DATABASES = {
'DRUPAL_DATABASE_URL',
default='sqlite:///{}'.format(base_dir('drupal.db')),
),
'spip': env.db_url(
'SPIP_DATABASE_URL',
default='sqlite:///{}'.format(base_dir('spip.db')),
),
}
DATABASE_ROUTERS = ['drupal2spip_lal.base.routers.Drupal2SPIPRouter']

Loading…
Cancel
Save