Ejemplo n.º 1
0
 def delete(self,*args):
     if self.params.key:
         item = Branch.get(self.params.key)
         if item:
             item.delete()
             self.status ='Branch is deleted!'
         else:
             self.status='Branch does not exist'
     else:
         self.status = 'Key was not Provided!'
     self.redirect(BranchController.get_url())
Ejemplo n.º 2
0
 def details(self, *args):
     if self.params.key:
         item = Branch.get(self.params.key)
         if item:
             return {'op':'update', 'BranchForm': BranchForm(instance=item)}
         else:
             self.status = 'Branch does not exists'
             self.redirect(BranchController.get_url())
     else:
         self.status = 'Key not provided'
         return {'op':'insert' ,'BranchForm':BranchForm()}
Ejemplo n.º 3
0
 def save(self, *args):
     instance = None
     if self.params.key:
         instance = Branch.get(self.params.key)
     form=BranchForm(data=self.request.POST, instance=instance)
     if form.is_valid():
         result=form.save(commit=False)
         result.put()
         self.status = 'Branch is saved'
         self.redirect(BranchController.get_url())
     else:
         self.SetTemplate(templateName = 'Branch_edit.html')
         self.status = 'Form is not Valid'
         return {'op':'update', 'BranchForm': form}