Commit 1ac30ed0 authored by ibuler's avatar ibuler

[Feature] 使用ztree

parent 3603b33a
...@@ -319,13 +319,13 @@ class TreeViewApi(APIView): ...@@ -319,13 +319,13 @@ class TreeViewApi(APIView):
def get(self, request): def get(self, request):
data = [] data = []
for node in self.get_queryset(): for node in self.get_queryset():
if node.id == "0": parent = ":".join(node.id.split(":")[:-1])
parent = "#" d = {
else:
parent = ":".join(node.id.split(":")[:-1])
data.append({
"id": node.id, "id": node.id,
"parent": parent, "pId": parent,
"text": node.name "name": node.name
}) }
return Response(data) if node.id == "0":
\ No newline at end of file d["open"] = True
data.append(d)
return Response(data)
This diff is collapsed.
...@@ -16,7 +16,7 @@ class TreeView(AdminUserRequiredMixin, TemplateView): ...@@ -16,7 +16,7 @@ class TreeView(AdminUserRequiredMixin, TemplateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = { context = {
'app': _('Assets'), 'app': _('Assets'),
'action': _('TreeView view'), 'action': _('Tree view'),
} }
kwargs.update(context) kwargs.update(context)
return super().get_context_data(**kwargs) 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