diff --git a/django/contrib/postgres/apps.py b/django/contrib/postgres/apps.py index 897cb09d3e9..1ab5074f19c 100644 --- a/django/contrib/postgres/apps.py +++ b/django/contrib/postgres/apps.py @@ -17,12 +17,12 @@ class PostgresConfig(AppConfig): for conn in connections.all(): if conn.vendor == 'postgresql': conn.introspection.data_types_reverse.update({ - 3802: 'django.contrib.postgresql.fields.JSONField', - 3904: 'django.contrib.postgresql.fields.IntegerRangeField', - 3906: 'django.contrib.postgresql.fields.FloatRangeField', - 3910: 'django.contrib.postgresql.fields.DateTimeRangeField', - 3912: 'django.contrib.postgresql.fields.DateRangeField', - 3926: 'django.contrib.postgresql.fields.BigIntegerRangeField', + 3802: 'django.contrib.postgres.fields.JSONField', + 3904: 'django.contrib.postgres.fields.IntegerRangeField', + 3906: 'django.contrib.postgres.fields.FloatRangeField', + 3910: 'django.contrib.postgres.fields.DateTimeRangeField', + 3912: 'django.contrib.postgres.fields.DateRangeField', + 3926: 'django.contrib.postgres.fields.BigIntegerRangeField', }) if conn.connection is not None: register_type_handlers(conn) diff --git a/docs/releases/2.0.5.txt b/docs/releases/2.0.5.txt index bba17eea9f5..c7a7a84d9ee 100644 --- a/docs/releases/2.0.5.txt +++ b/docs/releases/2.0.5.txt @@ -9,4 +9,5 @@ Django 2.0.5 fixes several bugs in 2.0.4. Bugfixes ======== -* ... +* Corrected the import paths that ``inspectdb`` generates for + ``django.contrib.postgres`` fields (:ticket:`29307`). diff --git a/tests/postgres_tests/test_introspection.py b/tests/postgres_tests/test_introspection.py index a63f08db509..2ab2c96cead 100644 --- a/tests/postgres_tests/test_introspection.py +++ b/tests/postgres_tests/test_introspection.py @@ -22,17 +22,17 @@ class InspectDBTests(PostgreSQLTestCase): def test_json_field(self): self.assertFieldsInModel( 'postgres_tests_jsonmodel', - ['field = django.contrib.postgresql.fields.JSONField(blank=True, null=True)'], + ['field = django.contrib.postgres.fields.JSONField(blank=True, null=True)'], ) def test_range_fields(self): self.assertFieldsInModel( 'postgres_tests_rangesmodel', [ - 'ints = django.contrib.postgresql.fields.IntegerRangeField(blank=True, null=True)', - 'bigints = django.contrib.postgresql.fields.BigIntegerRangeField(blank=True, null=True)', - 'floats = django.contrib.postgresql.fields.FloatRangeField(blank=True, null=True)', - 'timestamps = django.contrib.postgresql.fields.DateTimeRangeField(blank=True, null=True)', - 'dates = django.contrib.postgresql.fields.DateRangeField(blank=True, null=True)', + 'ints = django.contrib.postgres.fields.IntegerRangeField(blank=True, null=True)', + 'bigints = django.contrib.postgres.fields.BigIntegerRangeField(blank=True, null=True)', + 'floats = django.contrib.postgres.fields.FloatRangeField(blank=True, null=True)', + 'timestamps = django.contrib.postgres.fields.DateTimeRangeField(blank=True, null=True)', + 'dates = django.contrib.postgres.fields.DateRangeField(blank=True, null=True)', ], )