Exemplo n.º 1
0
 def delete(self, p_id):
     class_data = ClassModel.find_by_id(p_id)  #GET SINGLE DATA BY ID
     if class_data:
         class_data.db_to_delete()
         return {'message': 'Class data deleted successfully'}, 200
     else:
         return {'message': 'Class not found'}, 500
Exemplo n.º 2
0
    def put(self, p_id):
        data = parser.parse_args()
        class_data = ClassModel.find_by_id(p_id)
        class_data.update_data(class_data,data)

        try:
            class_data.db_to_commit()
            return {
                'message': ' This {} class data  updated successfully'.format(data['name'])
            }, 200
        except:
            return {'message': 'Something went wrong'}, 500
Exemplo n.º 3
0
 def get(self, p_id):
     class_data = ClassModel.find_by_id(p_id)  #GET SINGLE DATA BY ID
     jsonify_data = class_data.to_json(class_data)
     return {'class': jsonify_data}