[Update] 优化节点

pull/2882/head^2
ibuler 5 years ago
parent dc4ee2f0fa
commit bab4326aeb

@ -402,7 +402,7 @@ class Node(OrgModelMixin, FamilyMixin, FullValueMixin, AssetsAmountMixin):
def get_queryset(cls):
from ..utils import NodeUtil
util = NodeUtil()
return util.nodes
return sorted(util.nodes)
@classmethod
def generate_fake(cls, count=100):

@ -78,13 +78,10 @@ class AdminUserDetailView(PermissionsMixin, DetailView):
permission_classes = [IsOrgAdmin]
def get_context_data(self, **kwargs):
from ..utils import NodeUtil
nodes = Node.objects.all()
util = NodeUtil()
context = {
'app': _('Assets'),
'action': _('Admin user detail'),
'nodes': util.get_nodes_by_queryset(queryset=nodes),
'nodes': Node.get_queryset(),
}
kwargs.update(context)
return super().get_context_data(**kwargs)

@ -74,10 +74,11 @@ class SystemUserDetailView(PermissionsMixin, DetailView):
permission_classes = [IsOrgAdmin]
def get_context_data(self, **kwargs):
cmd_filters_remain = CommandFilter.objects.exclude(system_users=self.object)
context = {
'app': _('Assets'),
'action': _('System user detail'),
'cmd_filters_remain': CommandFilter.objects.exclude(system_users=self.object)
'cmd_filters_remain': cmd_filters_remain,
}
kwargs.update(context)
return super().get_context_data(**kwargs)

Loading…
Cancel
Save