def delete(self): if self.params.key: item = WishList.get(self.params.key) if item: item.delete() self.status = 'WishList is deleted!' else: self.status = 'WishList does not exist' else: self.status = 'Key was not Provided!' self.redirect(WishListController.get_url())
def delete(self): if self.params.key: item = WishList.get(self.params.key) if item: item.delete() self.status = "WishList is deleted!" else: self.status = "WishList does not exist" else: self.status = "Key was not Provided!" self.redirect(WishListController.get_url())
def list(self): self.SetTemplate(templateName='WishList_lst.html') results =None index = 0; count=1000 try: index = int(self.params.index) count = int(self.params.count) except: pass result = {'WishListList': WishList.all().fetch(limit=count, offset=index)} result.update(locals()) self.respond(result)
def edit(self): self.SetTemplate(templateName="WishList_shw.html") if self.params.key: item = WishList.get(self.params.key) if item: result = {"op": "upd", "WishListForm": WishListForm(instance=item)} self.respond(result) else: self.status = "WishList does not exists" self.redirect(WishListController.get_url()) else: if self.method == "POST": self.status = "Key not provided" self.respond({"op": "ins", "WishListForm": WishListForm()})
def show(self): self.SetTemplate(templateName='WishList_shw.html') if self.params.key: item = WishList.get(self.params.key) if item: result = {'op':'upd', 'WishListForm': WishListForm(instance=item)} self.respond(result) else: self.status = 'WishList does not exists' self.redirect(WishListController.get_url()) else: if self.method == 'POST': self.status = 'Key not provided' self.respond({'op':'ins' ,'WishListForm':WishListForm()})
def list(self): self.SetTemplate(templateName='WishList_lst.html') results = None index = 0 count = 1000 try: index = int(self.params.index) count = int(self.params.count) except: pass result = { 'WishListList': WishList.all().fetch(limit=count, offset=index) } result.update(locals()) self.respond(result)
def show(self): self.SetTemplate(templateName='WishList_shw.html') if self.params.key: item = WishList.get(self.params.key) if item: result = { 'op': 'upd', 'WishListForm': WishListForm(instance=item) } self.respond(result) else: self.status = 'WishList does not exists' self.redirect(WishListController.get_url()) else: if self.method == 'POST': self.status = 'Key not provided' self.respond({'op': 'ins', 'WishListForm': WishListForm()})
def insert(self): form = None if self.params.key: instance = WishList.get(self.params.key) form = WishListForm(instance=instance) else: form = WishListForm(data=self.request.POST) if form.is_valid(): result = form.save(commit=False) result.Owner = self.User result.put() self.status = 'WishList is saved' self.redirect(WishListController.get_url()) else: self.SetTemplate(templateName='WishList_shw.html') self.status = 'Form is not Valid' result = {'op': 'upd', 'WishListForm': form} self.respond(result)
def save(self): form = None if self.params.key: instance = WishList.get(self.params.key) form = WishListForm(instance=instance) else: form = WishListForm(data=self.request.POST) if form.is_valid(): result = form.save(commit=False) result.Owner = self.User result.put() self.status = "WishList is saved" self.redirect(WishListController.get_url()) else: self.SetTemplate(templateName="WishList_shw.html") self.status = "Form is not Valid" result = {"op": "upd", "WishListForm": form} self.respond(result)
def insert(self): form = None if self.params.key: instance = WishList.get(self.params.key) form = WishListForm(instance=instance) else: form = WishListForm(data=self.request.POST) if form.is_valid(): result=form.save(commit=False) result.Owner = self.User result.put() self.status = 'WishList is saved' self.redirect(WishListController.get_url()) else: self.SetTemplate(templateName = 'WishList_shw.html') self.status = 'Form is not Valid' result = {'op':'upd', 'WishListForm': form} self.respond(result)