Kaydet (Commit) 89f17e7c authored tarafından Daniel Wiesmann's avatar Daniel Wiesmann Kaydeden (comit) Tim Graham

Fixed #27014 -- Fixed annotations with database functions on PostGIS.

Thanks Sean Mc Allister for providing a test.
üst 48ede589
......@@ -15,7 +15,7 @@ class PostGISAdapter(object):
"""
Initialize on the spatial object.
"""
self.is_geometry = isinstance(obj, Geometry)
self.is_geometry = isinstance(obj, (Geometry, PostGISAdapter))
# Getting the WKB (in string form, to allow easy pickling of
# the adaptor) and the SRID from the geometry or raster.
......
......@@ -48,3 +48,6 @@ Bugfixes
* Fixed ``ClearableFileInput`` to avoid the ``required`` HTML attribute when
initial data exists (:ticket:`27037`).
* Fixed annotations with database functions when combined with lookups on
PostGIS (:ticket:`27014`).
......@@ -142,6 +142,9 @@ class GeographyFunctionTests(TestCase):
qs = Zipcode.objects.annotate(distance=Distance('poly', htown.point))
for z, ref in zip(qs, ref_dists):
self.assertAlmostEqual(z.distance.m, ref, 2)
# Distance function in combination with a lookup.
hzip = Zipcode.objects.get(code='77002')
self.assertEqual(qs.get(distance__lte=0), hzip)
@skipUnlessDBFeature("has_Area_function", "supports_distance_geodetic")
def test_geography_area(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment