def get_legends(self): items = [] for biome in DBSession.query(Biome)\ .filter(Biome.description != 'ffffff')\ .order_by(as_int(Biome.id)): items.append( HTML.label( HTML.span( literal(' '), style='background-color: #%s;' % biome.description, class_='biome-color'), literal(biome.name), style='margin-left: 1em; margin-right: 1em;')) yield Legend(self, 'categories', items)
def get_layers(self): for canton, dialects in itertools.groupby( DBSession.query(models.Variety).order_by( models.Variety.canton, as_int(common.Language.id)), lambda l: l.canton): dialects = list(dialects) json = DialectsGeoJson(None).render(dialects, self.req, dump=False) yield Layer(slug(canton), canton, data=json, marker=HTML.span( helpers.map_marker_img(self.req, dialects[0], marker=self.map_marker), literal(' '), dialects[0].canton_img(self.req), literal(' ')))
def order(self): return as_int(self.model_col)
def search(self, qs): return filter_number(as_int(self.model_col), qs, type_=int)
def order(self): return as_int(Biome.id)
def __init__(self, dt, name, **kw): kw['choices'] = DBSession.query(Biome.id, Biome.name)\ .order_by(as_int(Biome.id)) Col.__init__(self, dt, name, **kw)
def order(self): return as_int(common.Parameter.id)
def order(self): return as_int(common.Language.id)