From b002a032f90b8cd228cfcee6c88cd238a8191cc0 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Sat, 27 Jan 2018 11:12:11 +0100 Subject: Fixed #29054 -- Fixed a regression where a queryset that annotates with geometry objects crashes. Made GEOSGeometryBase hashable. Regression in 19b2dfd1bfe7fd716dd3d8bfa5f972070d83b42f. Thanks Tim Graham for the review. --- django/contrib/gis/geos/geometry.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'django') diff --git a/django/contrib/gis/geos/geometry.py b/django/contrib/gis/geos/geometry.py index bcda25fa2f..1ebecc864b 100644 --- a/django/contrib/gis/geos/geometry.py +++ b/django/contrib/gis/geos/geometry.py @@ -144,6 +144,9 @@ class GEOSGeometryBase(GEOSBase): return False return isinstance(other, GEOSGeometry) and self.srid == other.srid and self.equals_exact(other) + def __hash__(self): + return hash((self.srid, self.wkt)) + # ### Geometry set-like operations ### # Thanks to Sean Gillies for inspiration: # http://lists.gispython.org/pipermail/community/2007-July/001034.html -- cgit v1.3