Exemple #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())
Exemple #2
0
 def index(self, *args):
     results =None
     index = 0; count=1000
     try:
         index = int(self.params.index)
         count = int(self.params.count)
     except:
         pass
     result = {'WordSugestionList': WordSugestion.all().fetch(limit=count, offset=index)}
     result.update(locals())
     return result
Exemple #3
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()}
Exemple #4
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}