diff --git a/apps/users/templates/users/user_group_detail.html b/apps/users/templates/users/user_group_detail.html new file mode 100644 index 000000000..5c6fb6639 --- /dev/null +++ b/apps/users/templates/users/user_group_detail.html @@ -0,0 +1,111 @@ +{% extends 'base.html' %} +{% load static %} +{% load i18n %} + +{% block custom_head_css_js %} + + + + +{% endblock %} +{% block content %} +
+
+
+
+ +
+
+
+
+ {{ object.name }} + +
+
+ + + + + + + + + + + + + + +
{% trans 'Name' %}:{{ object.name }}
{% trans 'Comment' %}:{{ object.comment }}
{% trans 'Created at:' %}:{{ object.date_created }}
+
+
+
+
+
+
+ {% trans 'Quick modify' %} +
+
+ + + + + + + + + + + + + + + +
{% trans 'Active' %}: +
+
+ + +
+
+
{% trans 'Enable OTP' %}: +
+
+ + +
+
+
{% trans 'Reset password' %}: + + + +
+
+
+
+
+
+
+
+
+{% endblock %} diff --git a/apps/users/templates/users/user_group_list.html b/apps/users/templates/users/user_group_list.html index 851291880..9449e1e3a 100644 --- a/apps/users/templates/users/user_group_list.html +++ b/apps/users/templates/users/user_group_list.html @@ -1,18 +1,17 @@ {% extends '_list_base.html' %} {% load i18n %} -{% load common_tags %} {% block content_left_head %} - 添加用户组 +{% trans "Add User Group" %} {% endblock %} {% block table_head %} - 名称 - 用户数量 - 资产数量 - 描述 + {% trans "Name" %} + {% trans "User Amount" %} + {% trans "Asset Amount" %} + {% trans "Comment" %} {% endblock %} @@ -27,8 +26,8 @@ {{ user_group.name }} - {{ user_group.users.all|length }} - 数量 + {{ user_group.users.count }} + 999 {{ user_group.comment|truncatewords:8 }} 编辑 @@ -42,16 +41,12 @@ diff --git a/apps/users/templates/users/user_update.html b/apps/users/templates/users/user_update.html index f0a0907e2..36294a01f 100644 --- a/apps/users/templates/users/user_update.html +++ b/apps/users/templates/users/user_update.html @@ -5,7 +5,7 @@
- +
{% endblock %} diff --git a/apps/users/views.py b/apps/users/views.py index 2aa20efa5..b59f222c3 100644 --- a/apps/users/views.py +++ b/apps/users/views.py @@ -133,7 +133,7 @@ class UserUpdateView(AdminUserRequiredMixin, UpdateView): model = User form_class = UserUpdateForm template_name = 'users/user_update.html' - context_object_name = 'user' + context_object_name = 'user_object' success_url = reverse_lazy('users:user-list') def form_valid(self, form): @@ -146,10 +146,6 @@ class UserUpdateView(AdminUserRequiredMixin, UpdateView): user.set_password(password) return super(UserUpdateView, self).form_valid(form) - def form_invalid(self, form): - print(form.errors) - return super(UserUpdateView, self).form_invalid(form) - def get_context_data(self, **kwargs): context = super(UserUpdateView, self).get_context_data(**kwargs) context.update({'app': _('Users'), 'action': _('Update user')}) @@ -238,8 +234,14 @@ class UserGroupUpdateView(UpdateView): pass -class UserGroupDetailView(DetailView): - pass +class UserGroupDetailView(AdminUserRequiredMixin, DetailView): + model = UserGroup + template_name = 'users/user_group_detail.html' + + def get_context_data(self, **kwargs): + context = {'app': _('Users'), 'action': _('User Group Detail')} + kwargs.update(context) + return super(UserGroupDetailView, self).get_context_data(**kwargs) class UserGroupDeleteView(DeleteView):