def get(self): classes = [ "hex col-sm-6", "hex col-sm-6", "hex col-sm-6 templatemo-hex-top2", "hex col-sm-6 templatemo-hex-top3", "hex col-sm-6 templatemo-hex-top3", "hex col-sm-6 hex-offset templatemo-hex-top1 templatemo-hex-top2", "hex col-sm-6 templatemo-hex-top1 templatemo-hex-top3", "hex col-sm-6 templatemo-hex-top1 templatemo-hex-top3", "hex col-sm-6 templatemo-hex-top1 templatemo-hex-top2"] models = db_calls.get_temps() items = [{ "date": model.date, "temp": model.temperature, } for model in models] template_values = { "rows": items, "images1": [(cls, index+1) for index, cls in enumerate(classes)], "images2": [(cls, index+10) for index, cls in enumerate(classes)] } template = JINJA_ENVIRONMENT.get_template('templates/home.jinja2') self.response.write(template.render(template_values))
def get_temps(self, request): models = db_calls.get_temps() items = [presenter.copyTempPresenter(model) for model in models] return presenter.TempsPresenter(items=items)
def get(self): models = db_calls.get_temps() items = [presenter.dictTempPresenter(model) for model in models] self.response.write({"items": items})