def map_image(self, width, height): location = self.location or (self.venue and self.venue.location) if location: lat = location.get('latitude') lng = location.get('longitude') return maps.get_map_image( width, height, 13, [maps.Marker(lat, lng, 'dot-small-blue')])
def all_venues(): venues = Venue.query.order_by(Venue.name).all() markers = [maps.Marker(v.location.get('latitude'), v.location.get('longitude'), 'dot-small-pink') for v in venues] organized = {} for venue in venues: region = venue.location.get('region') locality = venue.location.get('locality') if region and locality: organized.setdefault(region, {})\ .setdefault(locality, [])\ .append(venue) map_image = maps.get_map_image(600, 400, 13, markers) return render_template('admin/venues.jinja2', venues=venues, organized=organized, map_image=map_image)
def map_image(self, width, height): lat = self.location.get('latitude') lng = self.location.get('longitude') return maps.get_map_image(width, height, 13, [maps.Marker(lat, lng, 'dot-small-pink')])