diff options
| author | Nick Pope <nick.pope@flightdataservices.com> | 2018-11-30 18:59:05 +0000 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-11-30 13:59:05 -0500 |
| commit | c3bbf1fd4cc73cf0f6109c81f2e44d44a4e25a0b (patch) | |
| tree | 4d046199959770728409c2c736737a0a6ba659e4 | |
| parent | 0d724ce91634970cda511e22272df333042e0a04 (diff) | |
Refs #28643 -- Skipped ATan2() workaround on SpatiaLite 5+.
| -rw-r--r-- | django/db/models/functions/math.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/django/db/models/functions/math.py b/django/db/models/functions/math.py index a08ac552aa..2df7ecf456 100644 --- a/django/db/models/functions/math.py +++ b/django/db/models/functions/math.py @@ -55,10 +55,12 @@ class ATan2(OutputFieldMixin, Func): arity = 2 def as_sqlite(self, compiler, connection, **extra_context): - if not getattr(connection.ops, 'spatialite', False) or connection.ops.spatial_version < (4, 3, 0): + if not getattr(connection.ops, 'spatialite', False) or not ( + (4, 3, 0) <= connection.ops.spatial_version < (5, 0, 0) + ): return self.as_sql(compiler, connection) # This function is usually ATan2(y, x), returning the inverse tangent - # of y / x, but it's ATan2(x, y) on SpatiaLite 4.3+. + # of y / x, but it's ATan2(x, y) on SpatiaLite >= 4.3.0, < 5.0.0. # Cast integers to float to avoid inconsistent/buggy behavior if the # arguments are mixed between integer and float or decimal. # https://www.gaia-gis.it/fossil/libspatialite/tktview?name=0f72cca3a2 |
