1
0
mirror of https://github.com/django/django.git synced 2025-10-25 06:36:07 +00:00

Refs #24928 -- Added introspection support for PostgreSQL JSONField

Thanks Adam Johnson and Tim Graham for the reviews.
This commit is contained in:
Claude Paroz
2017-09-09 14:39:09 +02:00
parent ffbee67f8e
commit 0cbb6ac007
4 changed files with 38 additions and 3 deletions

View File

@@ -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)