Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixed #11200 -- Now use a `set` data structure for `GoogleMap` icons …

…so that they aren't repeated in rendered JavaScript. Thanks to ludifan for ticket and initial patch.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 1ed5d8fc39aa634cacb740c916d1cef682063dbb 1 parent 419747d
@jbronn jbronn authored
6 django/contrib/gis/maps/google/
@@ -143,7 +143,7 @@ def xhtml(self):
def icons(self):
"Returns a sequence of GIcon objects in this map."
- return [marker.icon for marker in self.markers if marker.icon]
+ return set([marker.icon for marker in self.markers if marker.icon])
class GoogleMapSet(GoogleMap):
@@ -221,6 +221,6 @@ def onload(self):
def icons(self):
"Returns a sequence of all icons in each map of the set."
- icons = []
- for map in self.maps: icons.extend(map.icons)
+ icons = set()
+ for map in self.maps: icons |= map.icons
return icons
8 django/contrib/gis/maps/google/
@@ -231,6 +231,14 @@ def __init__(self, varname, image=None, iconsize=None,
self.iconanchor = iconanchor
self.infowindowanchor = infowindowanchor
+ def __cmp__(self, other):
+ return cmp(self.varname, other.varname)
+ def __hash__(self):
+ # XOR with hash of GIcon type so that hash('varname') won't
+ # equal hash(GIcon('varname')).
+ return hash(self.__class__) ^ hash(self.varname)
class GMarker(GOverlayBase):
A Python wrapper for the Google GMarker object. For more information

0 comments on commit 1ed5d8f

Please sign in to comment.
Something went wrong with that request. Please try again.