#27162 closed New feature (wontfix)
Move CreateExtension to django.db.backends.postgresql
| Reported by: | Claude Paroz | Owned by: | nobody |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
The CreateExtension currently lives in django.contrib.postgres.operations. I think that it's a core functionality of the PostgreSQL backend and it should be usable without requiring contrib.postgres. PostGIS users might want to use it to add extensions in migrations. I therefore suggest to move it to a new location inside django.db.backends.postgresql. Backwards compatibility is kept as CreateExtension will still be imported from the same module it is defined in currently.
Change History (7)
comment:1 by , 9 years ago
| Has patch: | set |
|---|
comment:2 by , 9 years ago
I understand the purity behind the rationale, but the new import path (django.db.backends.postgresql.migrations.operations.CreateExtension) seems a bit unwieldy. I guess the pattern looks better for third-party backends that don't have "django.db.backends" in the import path. Also, I think this is the first time we would have users importing code directly from a database backend. I guess that's a more common pattern for third-party backends which may provide custom fields. It raises the question why we have contrib.postres instead of putting that in the backend though.
Is it impossible to import from the current location without adding contrib.postgres to INSTALLED_APPS?
comment:3 by , 9 years ago
You are right, adding contrib.postgres to INSTALLED_APPS is not required, and this indeed makes my patch rather moot :-/
Do you agree about keeping the docs/ref/contrib/gis/install/postgis.txt and docs/ref/databases.txt additions from the patch (with paths corrected)?
comment:5 by , 9 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
PR