Commit 1ac30ed0 authored by ibuler's avatar ibuler

[Feature] 使用ztree

parent 3603b33a
......@@ -319,13 +319,13 @@ class TreeViewApi(APIView):
def get(self, request):
data = []
for node in self.get_queryset():
if node.id == "0":
parent = "#"
else:
parent = ":".join(node.id.split(":")[:-1])
data.append({
parent = ":".join(node.id.split(":")[:-1])
d = {
"id": node.id,
"parent": parent,
"text": node.name
})
return Response(data)
\ No newline at end of file
"pId": parent,
"name": node.name
}
if node.id == "0":
d["open"] = True
data.append(d)
return Response(data)
This diff is collapsed.
......@@ -16,7 +16,7 @@ class TreeView(AdminUserRequiredMixin, TemplateView):
def get_context_data(self, **kwargs):
context = {
'app': _('Assets'),
'action': _('TreeView view'),
'action': _('Tree view'),
}
kwargs.update(context)
return super().get_context_data(**kwargs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment