From bba144ef146309f4472a9eea2c3de6dc302091dc Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Sat, 19 Sep 2020 14:01:30 +0200 Subject: [PATCH] =?UTF-8?q?Inverse=20les=20op=C3=A9rations=20de=20lecture/?= =?UTF-8?q?ecriture=20par=20defaut=20->=20rw?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ce fix corrige le problème des opérations d'écritures dans la bdd master remote, qui marchaient mal, désormais les lignes de logs historiques sont correctement écrites. Il semblerait que django avait du mal à savoir que ces opérations reversion sont bien des opérations d'écriture. --- roles/radius/templates/local_routers.py.j2 | 4 ++-- roles/radius/templates/settings_local.py.j2 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/radius/templates/local_routers.py.j2 b/roles/radius/templates/local_routers.py.j2 index ce42020..0367f2c 100644 --- a/roles/radius/templates/local_routers.py.j2 +++ b/roles/radius/templates/local_routers.py.j2 @@ -7,13 +7,13 @@ class DbRouter(object): """ Attempts to read remote models go to local database. """ - return 'default' + return 'local' def db_for_write(self, model, **hints): """ Attempts to write remote models go to the remote database. """ - return 'master' + return 'default' def allow_relation(self, obj1, obj2, **hints): """ diff --git a/roles/radius/templates/settings_local.py.j2 b/roles/radius/templates/settings_local.py.j2 index 01d9043..0e47e36 100644 --- a/roles/radius/templates/settings_local.py.j2 +++ b/roles/radius/templates/settings_local.py.j2 @@ -51,7 +51,7 @@ TIME_ZONE = 'Europe/Paris' # The storage systems parameters to use DATABASES = { - 'master': { + 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 're2o', 'USER': 're2o', @@ -62,7 +62,7 @@ DATABASES = { 'COLLATION': 'utf8_general_ci' } }, - 'default': { + 'local': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 're2o', 'USER': 're2o_ro',