From 1a70504be4e1eb278439ebda1da7e7047281c4fa Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Sat, 22 Aug 2020 16:57:23 +0200 Subject: [PATCH 1/2] Try fixing the test failures --- tests/models.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/models.py b/tests/models.py index 4c9bd4f88..3bd15415a 100644 --- a/tests/models.py +++ b/tests/models.py @@ -13,8 +13,12 @@ class Binary(models.Model): try: from django.db.models import JSONField except ImportError: # Django<3.1 - from django.contrib.postgres.fields import JSONField + try: + from django.contrib.postgres.fields import JSONField + except ImportError: # psycopg2 not installed + JSONField = None -class PostgresJSON(models.Model): - field = JSONField() +if JSONField: + class PostgresJSON(models.Model): + field = JSONField() From 18fa5009d78f8f22af0d7e4902918e7c6020699d Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Sat, 22 Aug 2020 17:05:32 +0200 Subject: [PATCH 2/2] Fix one coding style problem --- tests/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/models.py b/tests/models.py index 3bd15415a..d6829eabc 100644 --- a/tests/models.py +++ b/tests/models.py @@ -20,5 +20,6 @@ class Binary(models.Model): if JSONField: + class PostgresJSON(models.Model): field = JSONField()