def post(self, company_id): c = CompanyNew.get_by_id(int(company_id)) if 'reload' in self.request.params: _load_delivery_terminals(c) time.sleep(0.5) dts = DeliveryTerminal.query(DeliveryTerminal.company_id == c.key.id()).fetch() else: dts = DeliveryTerminal.query(DeliveryTerminal.company_id == c.key.id()).fetch() for dt in dts: param_name = 'active_%s' % dt.key.id() dt.active = bool(self.request.get(param_name)) ndb.put_multi(dts) self.render('company/terminals/list.html', company=c, dts=dts)
def get(self, company_id): c = CompanyNew.get_by_id(int(company_id)) dts = DeliveryTerminal.query(DeliveryTerminal.company_id == c.key.id()).fetch() self.render('company/terminals/list.html', company=c, dts=dts)