1class MissingType(object): 2 pass 3 4 5try: 6 # Postgres fields are only available in Django with psycopg2 installed 7 # and we cannot have psycopg2 on PyPy 8 from django.contrib.postgres.fields import ( 9 ArrayField, 10 HStoreField, 11 JSONField as PGJSONField, 12 RangeField, 13 ) 14except ImportError: 15 ArrayField, HStoreField, PGJSONField, RangeField = (MissingType,) * 4 16 17try: 18 # JSONField is only available from Django 3.1 19 from django.db.models import JSONField 20except ImportError: 21 JSONField = MissingType 22