示例#1
0
 def delete(self, *args):
     if self.params.key:
         item = WordSugestion.get(self.params.key)
         if item:
             item.delete()
             self.status ='WordSugestion is deleted!'
         else:
             self.status='WordSugestion does not exist'
     else:
         self.status = 'Key was not Provided!'
     self.redirect(WordSugestionController.get_url())
示例#2
0
 def show(self, *args):
     self.SetTemplate(templateName='WordSugestion_edit.html')
     if self.params.key:
         item = WordSugestion.get(self.params.key)
         if item:
             result = {'op':'update', 'WordSugestionForm': WordSugestionForm(instance=item)}
             self.respond(result)
         else:
             self.status = 'WordSugestion does not exists'
             self.redirect(WordSugestionController.get_url())
     else:
         self.status = 'Key not provided'
         return {'op':'insert' ,'WordSugestionForm':WordSugestionForm()}
示例#3
0
 def insert(self, *args):
     instance = None
     if self.params.key:
         instance = WordSugestion.get(self.params.key)
     form=WordSugestionForm(data=self.request.POST, instance=instance)
     if form.is_valid():
         result=form.save(commit=False)
         result.put()
         self.status = 'WordSugestion is saved'
         self.redirect(WordSugestionController.get_url())
     else:
         self.SetTemplate(templateName = 'WordSugestion_edit.html')
         self.status = 'Form is not Valid'
         return {'op':'update', 'WordSugestionForm': form}