Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #10480 -- made `icons` a property to add more flexibility.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10102 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 9eb061b2c02a3f1c78c9d323498dffb97a713c32 1 parent 85733c5
@jbronn jbronn authored
Showing with 12 additions and 8 deletions.
  1. +12 −8 django/contrib/gis/maps/google/gmap.py
View
20 django/contrib/gis/maps/google/gmap.py
@@ -71,9 +71,6 @@ def __init__(self, key=None, api_url=None, version=None,
else:
getattr(self, varname).append(overlay_class(overlay))
- # Pulling any icons from the markers.
- self.icons = [marker.icon for marker in self.markers if marker.icon]
-
# If GMarker, GPolygons, and/or GPolylines are used the zoom will be
# automatically calculated via the Google Maps API. If both a zoom
# level and a center coordinate are provided with polygons/polylines,
@@ -143,6 +140,11 @@ def xhtml(self):
"Returns XHTML information needed for IE VML overlays."
return mark_safe('<html xmlns="http://www.w3.org/1999/xhtml" %s>' % self.xmlns)
+ @property
+ def icons(self):
+ "Returns a sequence of GIcon objects in this map."
+ return [marker.icon for marker in self.markers if marker.icon]
+
class GoogleMapSet(GoogleMap):
def __init__(self, *args, **kwargs):
@@ -173,11 +175,6 @@ def __init__(self, *args, **kwargs):
else:
self.maps = args
- # Creating the icons sequence from every map in this set.
- self.icons = []
- for map in self.maps:
- self.icons.extend(map.icons)
-
# Generating DOM ids for each of the maps in the set.
self.dom_ids = ['map%d' % i for i in xrange(len(self.maps))]
@@ -220,3 +217,10 @@ def onload(self):
# `google-multi.js`, which calls the load routines for
# each one of the individual maps in the set.
return mark_safe('onload="%s.load()"' % self.js_module)
+
+ @property
+ 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)
+ return icons
Please sign in to comment.
Something went wrong with that request. Please try again.