def googleMapShowUtils(points): markers = [] for point in points: marker = GMarker('POINT(%s %s)' % (point['lng'], point['lat'])) event = GEvent('click', 'function() { location.href = "%s"}' % point['href']) marker.add_event(event) markers.append(marker) google = GoogleMap(center=(0, 0), zoom=1, markers=markers, key=settings.GOOGLE_MAPS_API_PASSWORD) return google #add search utility here
def google_map(request): points = [ { 'lat': '35.42', 'lng': '139.42', 'href': 'http://en.wikipedia.org/wiki/Tokyo' }, { 'lat': '51.30', 'lng': '0.73', 'href': 'http://en.wikipedia.org/wiki/London' }, { 'lat': '40.43', 'lng': '-74.0', 'href': 'http://en.wikipedia.org/wiki/New_York_City' }, { 'lat': '34.03', 'lng': '-118.15', 'href': 'http://en.wikipedia.org/wiki/Los_Angeles' }, { 'lat': '36.774402', 'lng': '-119.755405', 'href': 'http://en.wikipedia.org/wiki/Fresno' }, ] markers = [] for point in points: marker = GMarker('POINT(%s %s)' % (point['lng'], point['lat'])) event = GEvent('click', 'function() { location.href = "%s"}' % point['href']) marker.add_event(event) markers.append(marker) google = GoogleMap(center=(0, 0), zoom=1, markers=markers, key=settings.GOOGLE_MAPS_API_PASSWORD) return render(request, 'rango/google_map.html', {'google': google})
def test_gevent_html_safe(self): from django.contrib.gis.maps.google.overlays import GEvent event = GEvent('click', 'function() {location.href = "http://www.google.com"}') self.assertTrue(hasattr(GEvent, '__html__')) self.assertEqual(force_text(event), event.__html__())
def test_gevent_html_safe(self): event = GEvent('click', 'function() {location.href = "http://www.google.com"}') self.assertTrue(hasattr(GEvent, '__html__')) self.assertEqual(force_text(event), event.__html__())