Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
    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)
Exemplo n.º 4
0
 def get(self):
     items = Allitems.query().fetch()
     params = {"items": items}
     return self.render_template("items_all.html", params=params)
Exemplo n.º 5
0
 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)