Beispiel #1
0
 def create(self):
     try:
         data_json = self.request.body
         m=Model()
         m.init_from_json(data_json, simple_conversion=True)
         m.upsert()
         self.success(message="todo, successfully created " + str(m.id), 
             data=m, format="json")
     except Exception as e:
         self.error(message="todo, error updating " + str(m.id) + "msg: " + str(e), 
             data=m, format="json")
Beispiel #2
0
 def destroy(self, id=None):
     try:
         data_json = self.request.body
         print("  .. DELETE Data: ID:" + str(data_json))
         m=Model()
         m.init_from_json(data_json)
         res = m.find_by_id(m.id)
         res.delete()
         self.success(message="todo, destroy id: " + str(m.id))
     except Exception as e:
         self.error(message="todo, destroy id: " + str(e))