Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Commit

Permalink
shim get_version() for django 2
Browse files Browse the repository at this point in the history
  • Loading branch information
chris48s committed Feb 24, 2018
1 parent b80ac09 commit 6f9472e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion dc_signup_form/signup_server/models.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down

0 comments on commit 6f9472e

Please sign in to comment.