def json(self, callback=True, **kw): places = [ dict(id=p.id, latitude=p.latitude, longitude=p.longitude, title=p.title, color=p.color) for p in Place.select() ] rv = dict(places=places) if callback: return "loadPlaces(%s)" % serializeJSON(rv) else: return rv
def mbl_index(self): all_places = list(Place.select()) # hard-code the removal of 2 places that aren't ready for the mobile page places = [p for p in all_places if (p.name != "lattings" and p.name != "setauket")] # compute the number of places in each region for mobile view region_counts = {} region_counts["all"] = len(places) for r in regions_short: region_counts[r] = Place.selectBy(region=r).count() return dict(places=places, region_counts=region_counts)
def then(self, **kw): """What do we need? places: to list them on the right patches: to annotate them on the map maps: to switch between them """ places = list(Place.select()) maps = list(MapAsset.select()) maps = sorted(maps, key=lambda x: x.year) map_vert = [] for i, m in enumerate(maps): if i != 0 and m.yearpos - maps[i - 1].yearpos < 5 and map_vert[i - 1] < 4: map_vert.append(map_vert[i - 1] + 1) else: map_vert.append(1) return dict(places=places, maps=maps, map_vert=map_vert)
def default(self, place_id, **kwargs): place = Place.get(int(place_id)) # cdata_description = "<blah><![CDATA[" + place.description + "]]></blah>", return dict( places=list(Place.select()), place=place, cdata_body="<![CDATA[" + place.body + "]]>", patch=place.patch, featured_image=place.featured_image, featured_video=place.featured_video, then_image=place.then_image, now_image=place.now_image, images=list(place.images), videos=list(place.videos), related_lessons=list(place.lessons), )
def full_export_mt(self): places = list(Place.select()) return dict(places=places)
def index(self, order_by="Place.q.name", **kw): places = list(Place.select()) return dict(places=places)
def list(self, **kw): # return self.search(**kw) places = list(Place.select()) return dict(places=places)