def post(self, id_or_name): id_or_name = int(id_or_name) attr_list = handle_arg_list(request.values.get("attr", "")) orders = list(range(len(attr_list))) PreferenceManager.create_or_update_show_attributes(id_or_name, list(zip(attr_list, orders))) return self.jsonify(type_id=id_or_name, attr_order=list(zip(attr_list, orders)))
def delete(self): name = request.values.get("name") PreferenceManager.delete_relation_view(name) return self.jsonify(name=name)
def post(self): name = request.values.get("name") cr_ids = request.values.get("cr_ids") views, id2type, name2id = PreferenceManager.create_or_update_relation_view(name, cr_ids) return self.jsonify(views=views, id2type=id2type, name2id=name2id)
def get(self): views, id2type, name2id = PreferenceManager.get_relation_view() return self.jsonify(views=views, id2type=id2type, name2id=name2id)
def post(self): type_id = request.values.get("type_id") levels = handle_arg_list(request.values.get("levels")) res = PreferenceManager.create_or_update_tree_view(type_id, levels) return self.jsonify(res and res.to_dict() or {})
def get(self): return self.jsonify(PreferenceManager.get_tree_view())
def get(self, id_or_name): is_subscribed, attributes = PreferenceManager.get_show_attributes(id_or_name) return self.jsonify(attributes=attributes, is_subscribed=is_subscribed)
def get(self): instance = request.values.get("instance") tree = request.values.get("tree") return self.jsonify(PreferenceManager.get_types(instance, tree))
def post(self): name = request.values.get("name") parent_id = request.values.get("parent_id") child_id = request.values.get("child_id") res = PreferenceManager.create_or_update_relation_view(name, parent_id, child_id) return self.jsonify(res.to_dict())
def get(self): return self.jsonify(PreferenceManager.get_relation_view())