Exemple #1
0
 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)))
Exemple #2
0
    def delete(self):
        name = request.values.get("name")
        PreferenceManager.delete_relation_view(name)

        return self.jsonify(name=name)
Exemple #3
0
    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)
Exemple #4
0
    def get(self):
        views, id2type, name2id = PreferenceManager.get_relation_view()

        return self.jsonify(views=views, id2type=id2type, name2id=name2id)
Exemple #5
0
    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 {})
Exemple #6
0
 def get(self):
     return self.jsonify(PreferenceManager.get_tree_view())
Exemple #7
0
    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)
Exemple #8
0
    def get(self):
        instance = request.values.get("instance")
        tree = request.values.get("tree")

        return self.jsonify(PreferenceManager.get_types(instance, tree))
Exemple #9
0
 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())
Exemple #10
0
 def get(self):
     return self.jsonify(PreferenceManager.get_relation_view())