summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bronn <jbronn@gmail.com>2009-03-08 18:34:24 +0000
committerJustin Bronn <jbronn@gmail.com>2009-03-08 18:34:24 +0000
commitcee31735f768322e2239857195cdb36e1fecc850 (patch)
tree32cea37692e9e3a4168f191d971ab454ff250d71
parent392f81cba91310a93409c7b83a507c69736a19d2 (diff)
Fixed #10072 -- `GMarker` overlays now have `draggable` option. Thanks to prairiedogg for ticket and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10002 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/contrib/gis/maps/google/overlays.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/django/contrib/gis/maps/google/overlays.py b/django/contrib/gis/maps/google/overlays.py
index 0efedf3632..37dd717b50 100644
--- a/django/contrib/gis/maps/google/overlays.py
+++ b/django/contrib/gis/maps/google/overlays.py
@@ -184,7 +184,7 @@ class GMarker(GOverlayBase):
return render_to_response('mytemplate.html',
{'google' : GoogleMap(markers=[marker])})
"""
- def __init__(self, geom, title=None):
+ def __init__(self, geom, title=None, draggable=False):
"""
The GMarker object may initialize on GEOS Points or a parameter
that may be instantiated into a GEOS point. Keyword options map to
@@ -193,6 +193,9 @@ class GMarker(GOverlayBase):
Keyword Options:
title:
Title option for GMarker, will be displayed as a tooltip.
+
+ draggable:
+ Draggable option for GMarker, disabled by default.
"""
# If a GEOS geometry isn't passed in, try to construct one.
if isinstance(geom, basestring): geom = fromstr(geom)
@@ -205,6 +208,7 @@ class GMarker(GOverlayBase):
self.envelope = geom.envelope
# TODO: Add support for more GMarkerOptions
self.title = title
+ self.draggable = draggable
super(GMarker, self).__init__()
def latlng_from_coords(self, coords):
@@ -212,7 +216,8 @@ class GMarker(GOverlayBase):
def options(self):
result = []
- if self.title: result.append('title: "%s"' % self.title)
+ if self.title: result.append('title: "%s"' % self.title)
+ if self.draggable: result.append('draggable: true')
return '{%s}' % ','.join(result)
@property