def get(self): items = Allitems.query().fetch() selected = Allitems.query(Allitems.item_select == True).fetch() params = { "items": sorted(items, key=lambda x: x.item_name), "selected": len(selected) } return self.render_template("items_all.html", params=params)
def post(self, item_id): items = Allitems.get_by_id(int(item_id)) items.item_select = True items.item_qty = float(self.request.get(item_id)) items.item_totalprice = items.item_qty * items.item_price items.put() select = Allitems.query(Allitems.item_select == True).fetch() params = {"selected": len(select)} return self.render_template("items_all.html", params=params)
def post(self, item_id): items = Allitems.get_by_id(int(item_id)) items.item_totalprice = items.item_price * items.item_qty items.put() for prices in items: total = total + prices.item_totalprice params = {"items": items, "total": round(total, 2)} return self.render_template("items_selected.html", params=params)
def post(self): itemname = self.request.get("item_name") itemprice = float(self.request.get("item_price").replace(",", ".")) itemshop = self.request.get("item_shop") itemean = int(self.request.get("item_ean")) import re findings = re.findall("<(\w+)>", itemname) findings2 = re.findall("<(\w+)>", itemshop) if findings or findings2: pass else: item = Allitems(item_name=itemname, item_price=itemprice, item_shop=itemshop, item_ean=itemean) item.put() items = Allitems.query().fetch() params = {"items": items} return self.render_template("items_all.html", params=params)
def post(self, item_id): newname = self.request.get("item_name") newprice = float(self.request.get("item_price").replace(",", ".")) import re findings = re.findall("<(\w+)>", newname) if findings: pass else: items = Allitems.get_by_id(int(item_id)) items.item_name = newname items.item_price = newprice items.put() return self.redirect_to("list")
def get(self, item_id): items = Allitems.get_by_id(int(item_id)) params = {"items": items} return self.render_template("items_all.html", params=params)
def get(self): items = Allitems.query().fetch() params = {"items": items} return self.render_template("items_all.html", params=params)
def post(self, item_id): items = Allitems.get_by_id(int(item_id)) items.key.delete() return self.redirect_to("list")
def get(self, item_id): items = Allitems.get_by_id(int(item_id)) selected = Allitems.query(Allitems.item_select == True).fetch() params = {"items": items, "selected": len(selected)} return self.render_template("items_delete.html", params=params)