diff options
| author | Claude Paroz <claude@2xlibre.net> | 2017-09-09 14:39:09 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2017-09-09 18:26:29 +0200 |
| commit | 0cbb6ac00770d201b8f30a404d516b97fe41485d (patch) | |
| tree | 59d7c55f7808e1ba186f53fdf8008a5b7797dab2 /django | |
| parent | ffbee67f8e17e1cfffcaa0116c170141a7363dda (diff) | |
Refs #24928 -- Added introspection support for PostgreSQL JSONField
Thanks Adam Johnson and Tim Graham for the reviews.
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/postgres/apps.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/django/contrib/postgres/apps.py b/django/contrib/postgres/apps.py index f298814f7d..2ad6aaefc8 100644 --- a/django/contrib/postgres/apps.py +++ b/django/contrib/postgres/apps.py @@ -15,8 +15,12 @@ class PostgresConfig(AppConfig): def ready(self): # Connections may already exist before we are called. for conn in connections.all(): - if conn.connection is not None: - register_type_handlers(conn) + if conn.vendor == 'postgresql': + conn.introspection.data_types_reverse.update({ + 3802: 'django.contrib.postgresql.fields.JSONField', + }) + if conn.connection is not None: + register_type_handlers(conn) connection_created.connect(register_type_handlers) CharField.register_lookup(Unaccent) TextField.register_lookup(Unaccent) |
