diff --git a/dc_signup_form/signup_server/management/commands/sync_to_sendgrid.py b/dc_signup_form/signup_server/management/commands/sync_to_sendgrid.py index f369061..5c467c2 100644 --- a/dc_signup_form/signup_server/management/commands/sync_to_sendgrid.py +++ b/dc_signup_form/signup_server/management/commands/sync_to_sendgrid.py @@ -3,7 +3,15 @@ import time from django.core.management.base import BaseCommand from django.db import connection -from django.db.backends.postgresql_psycopg2.version import get_version + +try: + # django < 2.0 + from django.db.backends.postgresql_psycopg2.version import get_version +except ImportError: + # django >= 2.0 + def get_version(connection): + return connection.pg_version + from django.db.models import Q from dc_signup_form.signup_server.models import SignupQueue from dc_signup_form.signup_server.wrappers import DCSendGridWrapper diff --git a/dc_signup_form/signup_server/models.py b/dc_signup_form/signup_server/models.py index 345acc1..dd302dc 100644 --- a/dc_signup_form/signup_server/models.py +++ b/dc_signup_form/signup_server/models.py @@ -1,7 +1,16 @@ import binascii import os from django.db import models -from django.db.backends.postgresql_psycopg2.version import get_version + +try: + # django < 2.0 + from django.db.backends.postgresql_psycopg2.version import get_version +except ImportError: + # django >= 2.0 + from django.db import connection + def get_version(connection): + return connection.pg_version + from django.contrib.postgres.fields import JSONField