def post(self, id):
     controller = CharacterController(request)
     try:
         character = controller.backup(id)
     except (DoesNotExist, ValidationError):
         api.abort(400, "Character with id {} does not exist".format(id))
     return character
    def get(self, id):
        controller = CharacterController(request)

        try:
            character = controller.get_element_detail(id)
        except (DoesNotExist, ValidationError):
            api.abort(400, "Character with id {} does not exist".format(id))

        return json.loads(character)
    def delete(self, id):
        controller = CharacterController(request)
        deleted = controller.delete(id)

        return deleted
    def post(self):
        controller = CharacterController(request)
        args = controller.new()

        return args
    def get(self):
        controller = CharacterController(request)
        query = controller.list()

        return jsonify(query)
Пример #6
0
def get_controller():
    controller = CharacterController(model=Character, request=request)
    return controller