From af56cd99a3128459ae9138a4c20b7e17f3eeb409 Mon Sep 17 00:00:00 2001 From: "KimSia, Sim" <245021+simkimsia@users.noreply.github.com> Date: Fri, 10 Jun 2022 17:12:31 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20REFACTOR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. invert not any => all 2. ensure that settigs.DATABASES has default set --- django_ltree/checks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_ltree/checks.py b/django_ltree/checks.py index 604be5a..2478393 100644 --- a/django_ltree/checks.py +++ b/django_ltree/checks.py @@ -8,7 +8,7 @@ def check_database_backend_is_postgres(app_configs, **kwargs): errors = [] valid_dbs = ["postgres", "postgis"] - if not any(d in settings.DATABASES["default"]["ENGINE"] for d in valid_dbs): + if "default" in settings.DATABASES and all(d not in settings.DATABASES["default"]["ENGINE"] for d in valid_dbs): errors.append( Warning( "django_ltree needs postgres to support install the ltree extension.",