ref: use same var names as before

This commit is contained in:
Víctor Fernández Poyatos
2025-03-12 16:20:43 +01:00
parent ac14f6f8d1
commit 6ca3a8e076
+4 -4
View File
@@ -8,14 +8,14 @@ class MainRouter:
admin_read = "admin_read"
def db_for_read(self, model, **hints): # noqa: F841
table = model._meta.db_table
if any(table.startswith(f"{app}_") for app in ALLOWED_APPS):
model_table_name = model._meta.db_table
if any(model_table_name.startswith(f"{app}_") for app in ALLOWED_APPS):
return self.admin_read
return self.user_read
def db_for_write(self, model, **hints): # noqa: F841
table = model._meta.db_table
if any(table.startswith(f"{app}_") for app in ALLOWED_APPS):
model_table_name = model._meta.db_table
if any(model_table_name.startswith(f"{app}_") for app in ALLOWED_APPS):
return self.admin_db
return self.default_db