compat: support pre 1.0 django-jsonfield (fixes #29917)
This commit is contained in:
parent
44d24825c7
commit
c60ed8b5ee
|
@ -105,14 +105,15 @@ class JSONField(object):
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from jsonfield import fields
|
import jsonfield.fields
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
# prevent django-jsonfield from modifying postgresql connection when we are
|
# prevent django-jsonfield from modifying postgresql connection when we are
|
||||||
# not using it
|
# not using it
|
||||||
def configure_database_connection(connection, **kwargs):
|
if hasattr(jsonfield.fields, 'connection_created'):
|
||||||
if django.VERSION < (1, 11):
|
def configure_database_connection(connection, **kwargs):
|
||||||
fields.configure_database_connection(connection, **kwargs)
|
if django.VERSION < (1, 11):
|
||||||
fields.connection_created.disconnect(fields.configure_database_connection)
|
jsonfield.fields.configure_database_connection(connection, **kwargs)
|
||||||
fields.connection_created.connect(configure_database_connection)
|
jsonfield.fields.connection_created.disconnect(jsonfield.fields.configure_database_connection)
|
||||||
|
jsonfield.fields.connection_created.connect(configure_database_connection)
|
||||||
|
|
Loading…
Reference in New Issue