Esempio n. 1
0
 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())
Esempio n. 2
0
 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())
Esempio n. 3
0
 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)
Esempio n. 4
0
 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()})
Esempio n. 5
0
 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()})
Esempio n. 6
0
 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)
Esempio n. 7
0
 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()})
Esempio n. 8
0
 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)
Esempio n. 9
0
 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)
Esempio n. 10
0
 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)