From 74b31cd26b9ad4ad85f131850a734f02aae988bb Mon Sep 17 00:00:00 2001 From: Clifford Gama Date: Fri, 16 May 2025 23:48:38 +0200 Subject: Fixed #32770 -- Added system check to ensure django.contrib.postgres is installed when using its features. Added postgres.E005 to validate 'django.contrib.postgres' is in INSTALLED_APPS when using: * PostgreSQL-specific fields (ArrayField, HStoreField, range fields, SearchVectorField), * PostgreSQL indexes (PostgresIndex and all subclasses), and * ExclusionConstraint The check provides immediate feedback during system checks rather than failing later with obscure runtime and database errors. Thanks to Simon Charette and Sarah Boyce for reviews. --- docs/ref/checks.txt | 4 +++- docs/releases/6.0.txt | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/ref/checks.txt b/docs/ref/checks.txt index 699a3d34c0..b9cb1d19cf 100644 --- a/docs/ref/checks.txt +++ b/docs/ref/checks.txt @@ -912,7 +912,7 @@ The following checks are performed when a model contains a ------------ The following checks are performed on :mod:`django.contrib.postgres` model -fields: +fields, indexes, and constraints: * **postgres.E001**: Base field for array has errors: ... * **postgres.E002**: Base field for array cannot be a related field. @@ -920,6 +920,8 @@ fields: instance so that it's not shared between all field instances. *This check was changed to* ``fields.E010`` *in Django 3.1*. * **postgres.W004**: Base field for array has warnings: ... +* **postgres.E005**: ``'django.contrib.postgres'`` must be in + ``INSTALLED_APPS`` in order to use ````. .. _sites-system-checks: diff --git a/docs/releases/6.0.txt b/docs/releases/6.0.txt index 118ad43cc9..362ea70ea0 100644 --- a/docs/releases/6.0.txt +++ b/docs/releases/6.0.txt @@ -84,7 +84,9 @@ Minor features :mod:`django.contrib.postgres` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -* ... +* Model fields, indexes, and constraints from :mod:`django.contrib.postgres` + now include system checks to verify that ``django.contrib.postgres`` is an + installed app. :mod:`django.contrib.redirects` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.3