summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/contrib/gis/db/backends/base/operations.py5
-rw-r--r--django/contrib/gis/db/backends/postgis/operations.py4
-rw-r--r--django/contrib/gis/db/models/functions.py9
-rw-r--r--django/db/backends/base/features.py6
-rw-r--r--django/db/backends/base/operations.py2
-rw-r--r--django/db/backends/sqlite3/operations.py2
-rw-r--r--django/db/models/lookups.py2
7 files changed, 16 insertions, 14 deletions
diff --git a/django/contrib/gis/db/backends/base/operations.py b/django/contrib/gis/db/backends/base/operations.py
index af85b83df6..4b1be4bedc 100644
--- a/django/contrib/gis/db/backends/base/operations.py
+++ b/django/contrib/gis/db/backends/base/operations.py
@@ -3,6 +3,7 @@ from django.contrib.gis.db.models.functions import Distance
from django.contrib.gis.measure import (
Area as AreaMeasure, Distance as DistanceMeasure,
)
+from django.db.utils import NotSupportedError
from django.utils.functional import cached_property
@@ -105,7 +106,7 @@ class BaseSpatialOperations:
def check_expression_support(self, expression):
if isinstance(expression, self.disallowed_aggregates):
- raise NotImplementedError(
+ raise NotSupportedError(
"%s spatial aggregation is not supported by this database backend." % expression.name
)
super().check_expression_support(expression)
@@ -115,7 +116,7 @@ class BaseSpatialOperations:
def spatial_function_name(self, func_name):
if func_name in self.unsupported_functions:
- raise NotImplementedError("This backend doesn't support the %s function." % func_name)
+ raise NotSupportedError("This backend doesn't support the %s function." % func_name)
return self.function_names.get(func_name, self.geom_func_prefix + func_name)
# Routines for getting the OGC-compliant models.
diff --git a/django/contrib/gis/db/backends/postgis/operations.py b/django/contrib/gis/db/backends/postgis/operations.py
index 51c8d5006e..4fb9e61ceb 100644
--- a/django/contrib/gis/db/backends/postgis/operations.py
+++ b/django/contrib/gis/db/backends/postgis/operations.py
@@ -13,7 +13,7 @@ from django.contrib.gis.measure import Distance
from django.core.exceptions import ImproperlyConfigured
from django.db.backends.postgresql.operations import DatabaseOperations
from django.db.models import Func, Value
-from django.db.utils import ProgrammingError
+from django.db.utils import NotSupportedError, ProgrammingError
from django.utils.functional import cached_property
from django.utils.version import get_version_tuple
@@ -231,7 +231,7 @@ class PostGISOperations(BaseSpatialOperations, DatabaseOperations):
geom_type = f.geom_type
if f.geography:
if f.srid != 4326:
- raise NotImplementedError('PostGIS only supports geography columns with an SRID of 4326.')
+ raise NotSupportedError('PostGIS only supports geography columns with an SRID of 4326.')
return 'geography(%s,%d)' % (geom_type, f.srid)
else:
diff --git a/django/contrib/gis/db/models/functions.py b/django/contrib/gis/db/models/functions.py
index 3dea6cbd13..fc46823b19 100644
--- a/django/contrib/gis/db/models/functions.py
+++ b/django/contrib/gis/db/models/functions.py
@@ -9,6 +9,7 @@ from django.db.models import (
)
from django.db.models.expressions import Func, Value
from django.db.models.functions import Cast
+from django.db.utils import NotSupportedError
from django.utils.functional import cached_property
NUMERIC_TYPES = (int, float, Decimal)
@@ -123,7 +124,7 @@ class Area(OracleToleranceMixin, GeoFunc):
def as_sql(self, compiler, connection, **extra_context):
if not connection.features.supports_area_geodetic and self.geo_field.geodetic(connection):
- raise NotImplementedError('Area on geodetic coordinate systems not supported.')
+ raise NotSupportedError('Area on geodetic coordinate systems not supported.')
return super().as_sql(compiler, connection, **extra_context)
def as_sqlite(self, compiler, connection, **extra_context):
@@ -316,7 +317,7 @@ class Length(DistanceResultMixin, OracleToleranceMixin, GeoFunc):
def as_sql(self, compiler, connection, **extra_context):
if self.geo_field.geodetic(connection) and not connection.features.supports_length_geodetic:
- raise NotImplementedError("This backend doesn't support Length on geodetic fields")
+ raise NotSupportedError("This backend doesn't support Length on geodetic fields")
return super().as_sql(compiler, connection, **extra_context)
def as_postgresql(self, compiler, connection):
@@ -372,7 +373,7 @@ class Perimeter(DistanceResultMixin, OracleToleranceMixin, GeoFunc):
def as_postgresql(self, compiler, connection):
function = None
if self.geo_field.geodetic(connection) and not self.source_is_geography():
- raise NotImplementedError("ST_Perimeter cannot use a non-projected non-geography field.")
+ raise NotSupportedError("ST_Perimeter cannot use a non-projected non-geography field.")
dim = min(f.dim for f in self.get_source_fields())
if dim > 2:
function = connection.ops.perimeter3d
@@ -380,7 +381,7 @@ class Perimeter(DistanceResultMixin, OracleToleranceMixin, GeoFunc):
def as_sqlite(self, compiler, connection):
if self.geo_field.geodetic(connection):
- raise NotImplementedError("Perimeter cannot use a non-projected field.")
+ raise NotSupportedError("Perimeter cannot use a non-projected field.")
return super().as_sql(compiler, connection)
diff --git a/django/db/backends/base/features.py b/django/db/backends/base/features.py
index 3a89cc0900..3706e12db1 100644
--- a/django/db/backends/base/features.py
+++ b/django/db/backends/base/features.py
@@ -1,5 +1,5 @@
from django.db.models.aggregates import StdDev
-from django.db.utils import ProgrammingError
+from django.db.utils import NotSupportedError, ProgrammingError
from django.utils.functional import cached_property
@@ -269,9 +269,9 @@ class BaseDatabaseFeatures:
"""Confirm support for STDDEV and related stats functions."""
try:
self.connection.ops.check_expression_support(StdDev(1))
- return True
- except NotImplementedError:
+ except NotSupportedError:
return False
+ return True
def introspected_boolean_field_type(self, field=None):
"""
diff --git a/django/db/backends/base/operations.py b/django/db/backends/base/operations.py
index 3517300b50..3d476b77da 100644
--- a/django/db/backends/base/operations.py
+++ b/django/db/backends/base/operations.py
@@ -579,7 +579,7 @@ class BaseDatabaseOperations:
This is used on specific backends to rule out known expressions
that have problematic or nonexistent implementations. If the
expression has a known problem, the backend should raise
- NotImplementedError.
+ NotSupportedError.
"""
pass
diff --git a/django/db/backends/sqlite3/operations.py b/django/db/backends/sqlite3/operations.py
index 408848c9ad..e90cc052d0 100644
--- a/django/db/backends/sqlite3/operations.py
+++ b/django/db/backends/sqlite3/operations.py
@@ -43,7 +43,7 @@ class DatabaseOperations(BaseDatabaseOperations):
pass
else:
if isinstance(output_field, bad_fields):
- raise NotImplementedError(
+ raise utils.NotSupportedError(
'You cannot use Sum, Avg, StdDev, and Variance '
'aggregations on date/time fields in sqlite3 '
'since date/time is saved as text.'
diff --git a/django/db/models/lookups.py b/django/db/models/lookups.py
index f79f435515..66945c4a1a 100644
--- a/django/db/models/lookups.py
+++ b/django/db/models/lookups.py
@@ -25,7 +25,7 @@ class Lookup:
# a bilateral transformation on a nested QuerySet: that won't work.
from django.db.models.sql.query import Query # avoid circular import
if isinstance(rhs, Query):
- raise NotImplementedError("Bilateral transformations on nested querysets are not supported.")
+ raise NotImplementedError("Bilateral transformations on nested querysets are not implemented.")
self.bilateral_transforms = bilateral_transforms
def apply_bilateral_transforms(self, value):