Ejemplo n.º 1
0
 def delete(self, *args):
     if self.params.key:
         item = RoleAssociation.get(self.params.key)
         if item:
             item.delete()
             self.status = 'RoleAssociation is deleted!'
         else:
             self.status = 'RoleAssociation does not exist'
     else:
         self.status = 'Key was not Provided!'
     self.redirect(RoleAssociationController.get_url())
Ejemplo n.º 2
0
 def delete(self, *args):
     if self.params.key:
         item = RoleAssociation.get(self.params.key)
         if item:
             item.delete()
             self.status = "RoleAssociation is deleted!"
         else:
             self.status = "RoleAssociation does not exist"
     else:
         self.status = "Key was not Provided!"
     self.redirect(RoleAssociationController.get_url())
Ejemplo n.º 3
0
 def list(self, *args):
     self.SetTemplate(templateName='RoleAssociation_lst.html')
     results =None
     index = 0; count=1000
     try:
         index = int(self.params.index)
         count = int(self.params.count)
     except:
         pass
     result = {'RoleAssociationList': RoleAssociation.all().fetch(limit=count, offset=index)}
     result.update(locals())
     self.respond(result)
Ejemplo n.º 4
0
 def edit(self, *args):
     self.SetTemplate(templateName="RoleAssociation_shw.html")
     if self.params.key:
         item = RoleAssociation.get(self.params.key)
         if item:
             result = {"op": "upd", "RoleAssociationForm": RoleAssociationForm(instance=item)}
             self.respond(result)
         else:
             self.status = "RoleAssociation does not exists"
             self.redirect(RoleAssociationController.get_url())
     else:
         self.status = "Key not provided"
         self.respond({"op": "ins", "RoleAssociationForm": RoleAssociationForm()})
Ejemplo n.º 5
0
 def show(self, *args):   
     self.SetTemplate(templateName='RoleAssociation_shw.html')
     if self.params.key:
         item = RoleAssociation.get(self.params.key)
         if item:
             result = {'op':'upd', 'RoleAssociationForm': RoleAssociationForm(instance=item)}
             self.respond(result)
         else:
             self.status = 'RoleAssociation does not exists'
             self.redirect(RoleAssociationController.get_url())
     else:
         self.status = 'Key not provided'
         self.respond({'op':'ins' ,'RoleAssociationForm':RoleAssociationForm()})
Ejemplo n.º 6
0
 def insert(self, *args):
     instance = None
     if self.params.key:
         instance = RoleAssociation.get(self.params.key)
     form = RoleAssociationForm(data=self.request.POST, instance=instance)
     if form.is_valid():
         result = form.save(commit=False)
         result.put()
         self.status = 'RoleAssociation is saved'
         self.redirect(RoleAssociationController.get_url())
     else:
         self.SetTemplate(templateName='RoleAssociation_shw.html')
         self.status = 'Form is not Valid'
         result = {'op': 'upd', 'RoleAssociationForm': form}
         self.respond(result)
Ejemplo n.º 7
0
 def save(self, *args):
     instance = None
     if self.params.key:
         instance = RoleAssociation.get(self.params.key)
     form = RoleAssociationForm(data=self.request.POST, instance=instance)
     if form.is_valid():
         result = form.save(commit=False)
         result.put()
         self.status = "RoleAssociation is saved"
         self.redirect(RoleAssociationController.get_url())
     else:
         self.SetTemplate(templateName="RoleAssociation_shw.html")
         self.status = "Form is not Valid"
         result = {"op": "upd", "RoleAssociationForm": form}
         self.respond(result)
Ejemplo n.º 8
0
 def insert(self, *args):
     instance = None
     if self.params.key:
         instance = RoleAssociation.get(self.params.key)
     form=RoleAssociationForm(data=self.request.POST, instance=instance)
     if form.is_valid():
         result=form.save(commit=False)
         result.put()
         self.status = 'RoleAssociation is saved'
         self.redirect(RoleAssociationController.get_url())
     else:
         self.SetTemplate(templateName = 'RoleAssociation_shw.html')
         self.status = 'Form is not Valid'
         result = {'op':'upd', 'RoleAssociationForm': form}
         self.respond(result)
Ejemplo n.º 9
0
 def list(self, *args):
     self.SetTemplate(templateName='RoleAssociation_lst.html')
     results = None
     index = 0
     count = 1000
     try:
         index = int(self.params.index)
         count = int(self.params.count)
     except:
         pass
     result = {
         'RoleAssociationList':
         RoleAssociation.all().fetch(limit=count, offset=index)
     }
     result.update(locals())
     self.respond(result)
Ejemplo n.º 10
0
 def show(self, *args):
     self.SetTemplate(templateName='RoleAssociation_shw.html')
     if self.params.key:
         item = RoleAssociation.get(self.params.key)
         if item:
             result = {
                 'op': 'upd',
                 'RoleAssociationForm': RoleAssociationForm(instance=item)
             }
             self.respond(result)
         else:
             self.status = 'RoleAssociation does not exists'
             self.redirect(RoleAssociationController.get_url())
     else:
         self.status = 'Key not provided'
         self.respond({
             'op': 'ins',
             'RoleAssociationForm': RoleAssociationForm()
         })