mirror of https://github.com/jumpserver/jumpserver
fix: 修改角色列表viewset排序问题
parent
2d514c0db0
commit
c3d01591e7
|
@ -17,6 +17,7 @@ __all__ = [
|
|||
|
||||
class RoleViewSet(JMSModelViewSet):
|
||||
queryset = Role.objects.all()
|
||||
ordering = ('-builtin', 'scope', 'name')
|
||||
serializer_classes = {
|
||||
'default': RoleSerializer,
|
||||
'users': RoleUserSerializer,
|
||||
|
@ -61,8 +62,7 @@ class RoleViewSet(JMSModelViewSet):
|
|||
return super().perform_update(serializer)
|
||||
|
||||
def get_queryset(self):
|
||||
queryset = super().get_queryset() \
|
||||
.annotate(permissions_amount=Count('permissions'))
|
||||
queryset = super().get_queryset().annotate(permissions_amount=Count('permissions'))
|
||||
return queryset
|
||||
|
||||
@action(methods=['GET'], detail=True)
|
||||
|
|
|
@ -43,7 +43,6 @@ class Role(JMSBaseModel):
|
|||
|
||||
class Meta:
|
||||
unique_together = [('name', 'scope')]
|
||||
ordering = ('-builtin', 'scope', 'name')
|
||||
verbose_name = _('Role')
|
||||
|
||||
def __str__(self):
|
||||
|
|
Loading…
Reference in New Issue