diff options
| author | Simon Charette <charette.s@gmail.com> | 2026-03-10 01:46:32 -0400 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2026-03-12 20:01:02 -0400 |
| commit | d43bd466e93aad7df13bb94fda4d01bc63b76a45 (patch) | |
| tree | 2b8a6e4dbe30df3e38ad615db214345a355417b7 | |
| parent | 1a8fd5cf75bf855852f6bc2f75c3da9f7b145669 (diff) | |
Refs #36727 -- Factored out _must_transform_value() in BaseSpatialOperations.
| -rw-r--r-- | django/contrib/gis/db/backends/base/operations.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/django/contrib/gis/db/backends/base/operations.py b/django/contrib/gis/db/backends/base/operations.py index 3ff13dfc86..c130744023 100644 --- a/django/contrib/gis/db/backends/base/operations.py +++ b/django/contrib/gis/db/backends/base/operations.py @@ -115,6 +115,10 @@ class BaseSpatialOperations: "Distance operations not available on this spatial backend." ) + @staticmethod + def _must_transform_value(value, field): + return value is not None and value.srid != field.srid + def get_geom_placeholder_sql(self, f, value, compiler): """ Return the placeholder for the given geometry field with the given @@ -122,18 +126,14 @@ class BaseSpatialOperations: stored procedure call to the transformation function of the spatial backend. """ - - def must_transform_value(value, field): - return value is not None and value.srid != field.srid - if hasattr(value, "as_sql"): sql, params = compiler.compile(value) - if must_transform_value(value.output_field, f): + if self._must_transform_value(value.output_field, f): transform_func = self.spatial_function_name("Transform") sql = f"{transform_func}({sql}, %s)" params = (*params, f.srid) return sql, params - elif must_transform_value(value, f): + elif self._must_transform_value(value, f): transform_func = self.spatial_function_name("Transform") sql = f"{transform_func}({self.from_text}(%s, %s), %s)" params = (value, value.srid, f.srid) |
