diff --git a/apps/users/api.py b/apps/users/api.py
index c90bde910..6fb1fe7c5 100644
--- a/apps/users/api.py
+++ b/apps/users/api.py
@@ -98,3 +98,16 @@ class GroupDeleteApi(generics.DestroyAPIView):
class UserBulkUpdateApi(ListBulkCreateUpdateDestroyAPIView):
queryset = User.objects.all()
serializer_class = UserBulkUpdateSerializer
+
+ def filter_queryset(self, queryset):
+ id_list = self.request.query_params.get('id__in')
+ if id_list:
+ import json
+ try:
+ ids = json.loads(id_list)
+ except Exception as e:
+ logger.error(str(e))
+ return queryset
+ if isinstance(ids, list):
+ queryset = queryset.filter(id__in=ids)
+ return queryset
diff --git a/apps/users/models.py b/apps/users/models.py
index 13206bdb2..200d3e038 100644
--- a/apps/users/models.py
+++ b/apps/users/models.py
@@ -215,6 +215,11 @@ class User(AbstractUser):
user.save()
user.groups.add(UserGroup.initial())
+ def delete(self):
+ if self.is_superuser:
+ return
+ return super(User, self).delete()
+
@classmethod
def generate_fake(cls, count=100):
from random import seed, choice
diff --git a/apps/users/templates/users/user_list.html b/apps/users/templates/users/user_list.html
index da36ab903..0773a0871 100644
--- a/apps/users/templates/users/user_list.html
+++ b/apps/users/templates/users/user_list.html
@@ -11,12 +11,12 @@
@@ -24,45 +24,12 @@
{% endblock %}
-
-{% block table_body %}
- {% for user in object_list %}
-
- {% trans 'Name' %}
- {% trans 'Username' %}
+ {% trans 'Name' %}
+ {% trans 'Username' %}
{% trans 'Role' %}
{% trans 'User group' %}
{% trans 'Asset num' %}
- {% trans 'Active' %}
+ {% trans 'Active' %}
{% trans 'Action' %}