0001-compat-support-pre-1.0-django-jsonfield-fixes-29917.patch
src/authentic2/compat.py | ||
---|---|---|
102 | 102 | |
103 | 103 | |
104 | 104 |
try: |
105 |
from jsonfield import fields
|
|
105 |
import jsonfield.fields
|
|
106 | 106 |
except ImportError: |
107 | 107 |
pass |
108 | 108 |
else: |
109 | 109 |
# prevent django-jsonfield from modifying postgresql connection when we are |
110 | 110 |
# not using it |
111 |
def configure_database_connection(connection, **kwargs): |
|
112 |
if django.VERSION < (1, 11): |
|
113 |
fields.configure_database_connection(connection, **kwargs) |
|
114 |
fields.connection_created.disconnect(fields.configure_database_connection) |
|
115 |
fields.connection_created.connect(configure_database_connection) |
|
111 |
if hasattr(jsonfield.fields, 'connection_created'): |
|
112 |
def configure_database_connection(connection, **kwargs): |
|
113 |
if django.VERSION < (1, 11): |
|
114 |
jsonfield.fields.configure_database_connection(connection, **kwargs) |
|
115 |
jsonfield.fields.connection_created.disconnect(jsonfield.fields.configure_database_connection) |
|
116 |
jsonfield.fields.connection_created.connect(configure_database_connection) |
|
116 |
- |