[Bugfix] 修复批量更新资产和用户的bug

pull/1683/head
ibuler 2018-08-13 15:01:56 +08:00
parent c9d137bc20
commit 75e67410cf
8 changed files with 141 additions and 106 deletions

View File

@ -9,6 +9,7 @@ import chardet
from io import StringIO
from django.db import transaction
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
from django.views.generic import TemplateView, ListView, View
from django.views.generic.edit import CreateView, DeleteView, FormView, UpdateView
@ -76,14 +77,6 @@ class AssetCreateView(AdminUserRequiredMixin, SuccessMessageMixin, CreateView):
template_name = 'assets/asset_create.html'
success_url = reverse_lazy('assets:asset-list')
# def form_valid(self, form):
# print("form valid")
# asset = form.save()
# asset.created_by = self.request.user.username or 'Admin'
# asset.date_created = timezone.now()
# asset.save()
# return super().form_valid(form)
def get_form(self, form_class=None):
form = super().get_form(form_class=form_class)
node_id = self.request.GET.get("node_id")
@ -106,29 +99,12 @@ class AssetCreateView(AdminUserRequiredMixin, SuccessMessageMixin, CreateView):
return create_success_msg % ({"name": cleaned_data["hostname"]})
# class AssetModalListView(AdminUserRequiredMixin, ListView):
# paginate_by = settings.DISPLAY_PER_PAGE
# model = Asset
# context_object_name = 'asset_modal_list'
# template_name = 'assets/_asset_list_modal.html'
#
# def get_context_data(self, **kwargs):
# assets = Asset.objects.all()
# assets_id = self.request.GET.get('assets_id', '')
# assets_id_list = [i for i in assets_id.split(',') if i.isdigit()]
# context = {
# 'all_assets': assets_id_list,
# 'assets': assets
# }
# kwargs.update(context)
# return super().get_context_data(**kwargs)
class AssetBulkUpdateView(AdminUserRequiredMixin, ListView):
model = Asset
form_class = forms.AssetBulkUpdateForm
template_name = 'assets/asset_bulk_update.html'
success_url = reverse_lazy('assets:asset-list')
success_message = _("Bulk update asset success")
id_list = None
form = None
@ -150,6 +126,7 @@ class AssetBulkUpdateView(AdminUserRequiredMixin, ListView):
form = self.form_class(request.POST)
if form.is_valid():
form.save()
messages.success(request, self.success_message)
return redirect(self.success_url)
else:
return self.get(request, form=form, *args, **kwargs)

Binary file not shown.

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Jumpserver 0.3.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-08-10 16:10+0800\n"
"POT-Creation-Date: 2018-08-13 15:01+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: ibuler <ibuler@qq.com>\n"
"Language-Team: Jumpserver team<ibuler@qq.com>\n"
@ -44,6 +44,7 @@ msgstr "节点管理"
#: assets/forms/asset.py:116 assets/models/asset.py:85
#: assets/models/cluster.py:19 assets/models/user.py:73
#: assets/templates/assets/asset_detail.html:73 templates/_nav.html:25
#: xpack/plugins/orgs/templates/orgs/org_list.html:18
msgid "Admin user"
msgstr "管理用户"
@ -54,11 +55,13 @@ msgstr "管理用户"
#: assets/templates/assets/asset_update.html:41
#: assets/templates/assets/asset_update.html:43
#: assets/templates/assets/user_asset_list.html:34
#: xpack/plugins/orgs/templates/orgs/org_list.html:20
msgid "Label"
msgstr "标签"
#: assets/forms/asset.py:37 assets/forms/asset.py:76 assets/models/asset.py:76
#: assets/models/domain.py:47 assets/templates/assets/user_asset_list.html:168
#: xpack/plugins/orgs/templates/orgs/org_list.html:17
msgid "Domain"
msgstr "网域"
@ -116,6 +119,7 @@ msgstr "端口"
#: terminal/templates/terminal/command_list.html:73
#: terminal/templates/terminal/session_list.html:41
#: terminal/templates/terminal/session_list.html:72
#: xpack/plugins/orgs/templates/orgs/org_list.html:16
msgid "Asset"
msgstr "资产"
@ -146,6 +150,9 @@ msgstr "资产"
#: users/templates/users/user_list.html:23
#: users/templates/users/user_profile.html:51
#: users/templates/users/user_pubkey_update.html:53
#: xpack/plugins/orgs/templates/orgs/org_detail.html:52
#: xpack/plugins/orgs/templates/orgs/org_list.html:12
#: xpack/templates/orgs/org_list.html:12
msgid "Name"
msgstr "名称"
@ -353,6 +360,7 @@ msgstr "创建者"
#: perms/templates/perms/asset_permission_detail.html:94
#: terminal/templates/terminal/terminal_detail.html:59 users/models/group.py:17
#: users/templates/users/user_group_detail.html:63
#: xpack/plugins/orgs/templates/orgs/org_detail.html:60
msgid "Date created"
msgstr "创建日期"
@ -376,6 +384,9 @@ msgstr "创建日期"
#: users/templates/users/user_group_detail.html:67
#: users/templates/users/user_group_list.html:14
#: users/templates/users/user_profile.html:130
#: xpack/plugins/orgs/templates/orgs/org_detail.html:64
#: xpack/plugins/orgs/templates/orgs/org_list.html:22
#: xpack/templates/orgs/org_list.html:14
msgid "Comment"
msgstr "备注"
@ -455,7 +466,11 @@ msgstr "默认资产组"
#: terminal/templates/terminal/session_list.html:71 users/forms.py:312
#: users/models/user.py:33 users/models/user.py:348
#: users/templates/users/user_group_detail.html:78
#: users/templates/users/user_group_list.html:13 users/views/user.py:379
#: users/templates/users/user_group_list.html:13 users/views/user.py:378
#: xpack/plugins/orgs/forms.py:26
#: xpack/plugins/orgs/templates/orgs/org_detail.html:113
#: xpack/plugins/orgs/templates/orgs/org_list.html:14
#: xpack/templates/orgs/org_list.html:13
msgid "User"
msgstr "用户"
@ -485,9 +500,9 @@ msgstr "手动登录"
#: assets/templates/assets/system_user_asset.html:21
#: assets/views/admin_user.py:29 assets/views/admin_user.py:47
#: assets/views/admin_user.py:63 assets/views/admin_user.py:78
#: assets/views/admin_user.py:102 assets/views/asset.py:52
#: assets/views/asset.py:99 assets/views/asset.py:159 assets/views/asset.py:176
#: assets/views/asset.py:200 assets/views/domain.py:29
#: assets/views/admin_user.py:102 assets/views/asset.py:53
#: assets/views/asset.py:92 assets/views/asset.py:136 assets/views/asset.py:153
#: assets/views/asset.py:177 assets/views/domain.py:29
#: assets/views/domain.py:45 assets/views/domain.py:61
#: assets/views/domain.py:74 assets/views/domain.py:98
#: assets/views/domain.py:126 assets/views/domain.py:145
@ -533,6 +548,7 @@ msgstr "登录模式"
#: terminal/templates/terminal/command_list.html:74
#: terminal/templates/terminal/session_list.html:49
#: terminal/templates/terminal/session_list.html:73
#: xpack/plugins/orgs/templates/orgs/org_list.html:19
msgid "System user"
msgstr "系统用户"
@ -621,7 +637,7 @@ msgstr "资产csv文件"
msgid "If set id, will use this id update asset existed"
msgstr "如果设置了id则会使用该行信息更新该id的资产"
#: assets/templates/assets/_asset_list_modal.html:7 assets/views/asset.py:53
#: assets/templates/assets/_asset_list_modal.html:7 assets/views/asset.py:54
#: templates/_nav.html:23
msgid "Asset list"
msgstr "资产列表"
@ -709,7 +725,7 @@ msgid "Submit"
msgstr "提交"
#: assets/templates/assets/_user_asset_detail_modal.html:11
#: assets/templates/assets/asset_detail.html:20 assets/views/asset.py:201
#: assets/templates/assets/asset_detail.html:20 assets/views/asset.py:178
msgid "Asset detail"
msgstr "资产详情"
@ -791,6 +807,9 @@ msgstr "测试"
#: users/templates/users/user_list.html:77
#: users/templates/users/user_profile.html:151
#: users/templates/users/user_profile.html:180
#: xpack/plugins/orgs/templates/orgs/org_detail.html:25
#: xpack/plugins/orgs/templates/orgs/org_list.html:85
#: xpack/templates/orgs/org_list.html:43
msgid "Update"
msgstr "更新"
@ -814,6 +833,9 @@ msgstr "更新"
#: users/templates/users/user_group_list.html:45
#: users/templates/users/user_list.html:81
#: users/templates/users/user_list.html:85
#: xpack/plugins/orgs/templates/orgs/org_detail.html:29
#: xpack/plugins/orgs/templates/orgs/org_list.html:87
#: xpack/templates/orgs/org_list.html:45
msgid "Delete"
msgstr "删除"
@ -840,6 +862,8 @@ msgstr "选择节点"
#: users/templates/users/user_group_list.html:86
#: users/templates/users/user_list.html:200
#: users/templates/users/user_profile.html:222
#: xpack/plugins/orgs/templates/orgs/org_create_update.html:33
#: xpack/templates/orgs/org_list.html:86
msgid "Confirm"
msgstr "确认"
@ -873,6 +897,8 @@ msgstr "比例"
#: terminal/templates/terminal/terminal_list.html:36
#: users/templates/users/user_group_list.html:15
#: users/templates/users/user_list.html:29
#: xpack/plugins/orgs/templates/orgs/org_list.html:23
#: xpack/templates/orgs/org_list.html:15
msgid "Action"
msgstr "动作"
@ -928,7 +954,7 @@ msgstr "刷新"
msgid "Update successfully!"
msgstr "更新成功"
#: assets/templates/assets/asset_list.html:68 assets/views/asset.py:100
#: assets/templates/assets/asset_list.html:68 assets/views/asset.py:93
msgid "Create asset"
msgstr "创建资产"
@ -1033,6 +1059,7 @@ msgstr "重命名失败,不可以更改根节点名称"
#: users/templates/users/user_detail.html:461
#: users/templates/users/user_group_list.html:81
#: users/templates/users/user_list.html:195
#: xpack/templates/orgs/org_list.html:81
msgid "Are you sure?"
msgstr "你确认吗?"
@ -1179,19 +1206,23 @@ msgstr "更新管理用户"
msgid "Admin user detail"
msgstr "管理用户详情"
#: assets/views/asset.py:66 templates/_nav_user.html:4
#: assets/views/asset.py:67 templates/_nav_user.html:4
msgid "My assets"
msgstr "我的资产"
#: assets/views/asset.py:160
#: assets/views/asset.py:107
msgid "Bulk update asset success"
msgstr "批量更新资产成功"
#: assets/views/asset.py:137
msgid "Bulk update asset"
msgstr "批量更新资产"
#: assets/views/asset.py:177
#: assets/views/asset.py:154
msgid "Update asset"
msgstr "更新资产"
#: assets/views/asset.py:317
#: assets/views/asset.py:294
msgid "already exists"
msgstr "已经存在"
@ -1658,6 +1689,7 @@ msgid "Become"
msgstr "Become"
#: ops/models/adhoc.py:161 users/templates/users/user_group_detail.html:59
#: xpack/plugins/orgs/templates/orgs/org_detail.html:56
msgid "Create by"
msgstr "创建者"
@ -1876,18 +1908,19 @@ msgstr "任务列表"
msgid "Task run history"
msgstr "执行历史"
#: perms/forms.py:20 users/forms.py:265 users/forms.py:270 users/forms.py:282
#: users/forms.py:316
#: perms/forms.py:20 users/forms.py:265 users/forms.py:270 users/forms.py:316
#: xpack/plugins/orgs/forms.py:30
msgid "Select users"
msgstr "选择用户"
#: perms/forms.py:44 perms/models.py:30 perms/models.py:79
#: perms/templates/perms/asset_permission_list.html:55
#: perms/templates/perms/asset_permission_list.html:145 templates/_nav.html:14
#: users/models/group.py:26 users/models/user.py:57
#: users/forms.py:282 users/models/group.py:26 users/models/user.py:57
#: users/templates/users/_select_user_modal.html:16
#: users/templates/users/user_detail.html:200
#: users/templates/users/user_list.html:26
#: xpack/plugins/orgs/templates/orgs/org_list.html:15
msgid "User group"
msgstr "用户组"
@ -1906,7 +1939,7 @@ msgstr ""
msgid "Date expired"
msgstr "失效日期"
#: perms/models.py:92 templates/_nav.html:34
#: perms/models.py:91 templates/_nav.html:34
msgid "Asset permission"
msgstr "资产授权"
@ -1931,6 +1964,8 @@ msgstr "添加资产"
#: perms/templates/perms/asset_permission_user.html:97
#: perms/templates/perms/asset_permission_user.html:125
#: users/templates/users/user_group_detail.html:95
#: xpack/plugins/orgs/templates/orgs/org_detail.html:93
#: xpack/plugins/orgs/templates/orgs/org_detail.html:130
msgid "Add"
msgstr "添加"
@ -1998,6 +2033,7 @@ msgstr "选择用户组"
#: perms/views.py:23 perms/views.py:53 perms/views.py:68 perms/views.py:83
#: perms/views.py:118 perms/views.py:150 templates/_nav.html:31
#: xpack/plugins/orgs/templates/orgs/org_list.html:21
msgid "Perms"
msgstr "权限管理"
@ -2036,7 +2072,7 @@ msgstr "文档"
#: users/templates/users/user_profile.html:17
#: users/templates/users/user_profile_update.html:37
#: users/templates/users/user_profile_update.html:57
#: users/templates/users/user_pubkey_update.html:37 users/views/user.py:361
#: users/templates/users/user_pubkey_update.html:37 users/views/user.py:360
msgid "Profile"
msgstr "个人信息"
@ -2089,13 +2125,13 @@ msgstr ""
#: templates/_nav.html:10 users/views/group.py:27 users/views/group.py:43
#: users/views/group.py:61 users/views/group.py:78 users/views/group.py:94
#: users/views/login.py:333 users/views/login.py:397 users/views/user.py:68
#: users/views/user.py:83 users/views/user.py:111 users/views/user.py:193
#: users/views/user.py:348 users/views/user.py:398 users/views/user.py:433
#: users/views/login.py:333 users/views/login.py:397 users/views/user.py:67
#: users/views/user.py:82 users/views/user.py:110 users/views/user.py:192
#: users/views/user.py:347 users/views/user.py:397 users/views/user.py:432
msgid "Users"
msgstr "用户管理"
#: templates/_nav.html:13 users/views/user.py:69
#: templates/_nav.html:13 users/views/user.py:68
msgid "User list"
msgstr "用户列表"
@ -2449,7 +2485,7 @@ msgstr "添加到用户组"
msgid "Public key should not be the same as your old one."
msgstr "不能和原来的密钥相同"
#: users/forms.py:114 users/forms.py:247 users/serializers.py:48
#: users/forms.py:114 users/forms.py:247 users/serializers.py:49
msgid "Not a valid ssh public key"
msgstr "ssh密钥不合法"
@ -2799,7 +2835,7 @@ msgid "Very strong"
msgstr "很强"
#: users/templates/users/user_create.html:4
#: users/templates/users/user_list.html:16 users/views/user.py:83
#: users/templates/users/user_list.html:16 users/views/user.py:82
msgid "Create user"
msgstr "创建用户"
@ -2808,7 +2844,7 @@ msgid "Reset link will be generated and sent to the user. "
msgstr "生成重置密码连接,通过邮件发送给用户"
#: users/templates/users/user_detail.html:19
#: users/templates/users/user_granted_asset.html:18 users/views/user.py:194
#: users/templates/users/user_granted_asset.html:18 users/views/user.py:193
msgid "User detail"
msgstr "用户详情"
@ -2897,6 +2933,7 @@ msgid "After unlocking the user, the user can log in normally."
msgstr "解除用户登录限制后,此用户即可正常登录"
#: users/templates/users/user_group_create_update.html:31
#: xpack/plugins/orgs/templates/orgs/org_create_update.html:32
msgid "Cancel"
msgstr "取消"
@ -2907,27 +2944,33 @@ msgid "User group detail"
msgstr "用户组详情"
#: users/templates/users/user_group_detail.html:86
#: xpack/plugins/orgs/templates/orgs/org_detail.html:121
msgid "Add user"
msgstr "添加用户"
#: users/templates/users/user_group_list.html:5 users/views/group.py:44
#: xpack/templates/orgs/org_list.html:5
msgid "Create user group"
msgstr "创建用户组"
#: users/templates/users/user_group_list.html:82
#: xpack/templates/orgs/org_list.html:82
msgid "This will delete the selected groups !!!"
msgstr "删除选择组"
#: users/templates/users/user_group_list.html:90
#: xpack/templates/orgs/org_list.html:90
msgid "UserGroups Deleted."
msgstr "用户组删除"
#: users/templates/users/user_group_list.html:91
#: users/templates/users/user_group_list.html:96
#: xpack/templates/orgs/org_list.html:91 xpack/templates/orgs/org_list.html:96
msgid "UserGroups Delete"
msgstr "用户组删除"
#: users/templates/users/user_group_list.html:95
#: xpack/templates/orgs/org_list.html:95
msgid "UserGroup Deleting failed."
msgstr "用户组删除失败"
@ -2952,8 +2995,8 @@ msgstr "用户删除失败"
msgid "Administrator Settings force MFA login"
msgstr "管理员设置强制使用MFA登录"
#: users/templates/users/user_profile.html:116 users/views/user.py:224
#: users/views/user.py:278
#: users/templates/users/user_profile.html:116 users/views/user.py:223
#: users/views/user.py:277
msgid "User groups"
msgstr "用户组"
@ -2999,7 +3042,7 @@ msgid ""
"corresponding private key."
msgstr "新的公钥已设置成功,请下载对应的私钥"
#: users/templates/users/user_update.html:4 users/views/user.py:112
#: users/templates/users/user_update.html:4 users/views/user.py:111
msgid "Update user"
msgstr "更新用户"
@ -3157,7 +3200,7 @@ msgstr "用户组授权资产"
msgid "Please enable cookies and try again."
msgstr "设置你的浏览器支持cookie"
#: users/views/login.py:181 users/views/user.py:518 users/views/user.py:543
#: users/views/login.py:181 users/views/user.py:517 users/views/user.py:542
msgid "MFA code invalid"
msgstr "MFA码认证失败"
@ -3198,7 +3241,7 @@ msgstr "Token错误或失效"
msgid "Password not same"
msgstr "密码不一致"
#: users/views/login.py:295 users/views/user.py:127 users/views/user.py:416
#: users/views/login.py:295 users/views/user.py:126 users/views/user.py:415
msgid "* Your password does not meet the requirements"
msgstr "* 您的密码不符合要求"
@ -3210,82 +3253,101 @@ msgstr "首次登陆"
msgid "Login log list"
msgstr "登录日志"
#: users/views/user.py:144
#: users/views/user.py:143
msgid "Bulk update user success"
msgstr "批量更新用户成功"
#: users/views/user.py:253
#: users/views/user.py:173
msgid "Bulk update user"
msgstr "批量更新用户"
#: users/views/user.py:252
msgid "Invalid file."
msgstr "文件不合法"
#: users/views/user.py:349
#: users/views/user.py:348
msgid "User granted assets"
msgstr "用户授权资产"
#: users/views/user.py:380
#: users/views/user.py:379
msgid "Profile setting"
msgstr "个人信息设置"
#: users/views/user.py:399
#: users/views/user.py:398
msgid "Password update"
msgstr "密码更新"
#: users/views/user.py:434
#: users/views/user.py:433
msgid "Public key update"
msgstr "密钥更新"
#: users/views/user.py:475
#: users/views/user.py:474
msgid "Password invalid"
msgstr "用户名或密码无效"
#: users/views/user.py:569
#: users/views/user.py:568
msgid "MFA enable success"
msgstr "MFA 绑定成功"
#: users/views/user.py:570
#: users/views/user.py:569
msgid "MFA enable success, return login page"
msgstr "MFA 绑定成功,返回到登录页面"
#: users/views/user.py:572
#: users/views/user.py:571
msgid "MFA disable success"
msgstr "MFA 解绑成功"
#: users/views/user.py:573
#: users/views/user.py:572
msgid "MFA disable success, return login page"
msgstr "MFA 解绑成功,返回登录页面"
#~ msgid "Admin"
#~ msgstr "管理员"
#: xpack/plugins/orgs/forms.py:14
#: xpack/plugins/orgs/templates/orgs/org_detail.html:76
#: xpack/plugins/orgs/templates/orgs/org_list.html:13
msgid "Admin"
msgstr "管理员"
#~ msgid "Select admins"
#~ msgstr "选择管理员"
#: xpack/plugins/orgs/forms.py:18
msgid "Select admins"
msgstr "选择管理员"
#~ msgid "Organization"
#~ msgstr "组织管理"
#: xpack/plugins/orgs/meta.py:8
msgid "Organization"
msgstr "组织管理"
#~ msgid "Org detail"
#~ msgstr "组织详情"
#: xpack/plugins/orgs/templates/orgs/org_detail.html:22
#: xpack/plugins/orgs/views.py:73
msgid "Org detail"
msgstr "组织详情"
#~ msgid "Add admin"
#~ msgstr "添加管理员"
#: xpack/plugins/orgs/templates/orgs/org_detail.html:84
msgid "Add admin"
msgstr "添加管理员"
#~ msgid "Create organization "
#~ msgstr "创建组织"
#: xpack/plugins/orgs/templates/orgs/org_list.html:5
msgid "Create organization "
msgstr "创建组织"
#~ msgid "Org"
#~ msgstr "组织"
#: xpack/plugins/orgs/views.py:24
msgid "Org"
msgstr "组织"
#~ msgid "Org list"
#~ msgstr "组织列表"
#: xpack/plugins/orgs/views.py:25
msgid "Org list"
msgstr "组织列表"
#~ msgid "Orgs"
#~ msgstr "组织"
#: xpack/plugins/orgs/views.py:40 xpack/plugins/orgs/views.py:56
#: xpack/plugins/orgs/views.py:72
msgid "Orgs"
msgstr "组织"
#~ msgid "Create org"
#~ msgstr "创建组织"
#: xpack/plugins/orgs/views.py:41
msgid "Create org"
msgstr "创建组织"
#~ msgid "Update org"
#~ msgstr "更新组织"
#: xpack/plugins/orgs/views.py:57
msgid "Update org"
msgstr "更新组织"
#~ msgid "* required Must set exact system platform, Windows, Linux ..."
#~ msgstr "* required 必须准确设置操作系统平台如Windows, Linux ..."

View File

@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
#
from threading import local
from werkzeug.local import Local
from django.db import models
from django.db.models import Q
from django.shortcuts import redirect
import warnings
from django.forms import ModelForm
from django.http.response import HttpResponseForbidden
@ -14,7 +13,7 @@ from .utils import current_org, set_current_org, set_to_root_org
from .models import Organization
logger = get_logger(__file__)
tl = local()
tl = Local()
__all__ = [
'OrgManager', 'OrgViewGenericMixin', 'OrgModelMixin', 'OrgModelForm',
@ -93,8 +92,8 @@ class RootOrgViewMixin:
class OrgModelForm(ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if 'initial' not in kwargs:
return
# if 'initial' not in kwargs:
# return
for name, field in self.fields.items():
if not hasattr(field, 'queryset'):
continue

View File

@ -2,16 +2,13 @@
#
from functools import partial
from werkzeug.local import Local
from common.utils import LocalProxy
from .models import Organization
try:
from threading import local
except ImportError:
from django.utils._threading_local import local
_thread_locals = local()
_thread_locals = Local()
def get_org_from_request(request):

View File

@ -258,12 +258,12 @@ class UserPublicKeyForm(forms.Form):
UserPublicKeyForm.verbose_name = _("Public key")
class UserBulkUpdateForm(forms.ModelForm):
class UserBulkUpdateForm(OrgModelForm):
users = forms.ModelMultipleChoiceField(
required=True,
help_text='* required',
label=_('Select users'),
queryset = User.objects.all(),
queryset=User.objects.all(),
widget=forms.SelectMultiple(
attrs={
'class': 'select2',
@ -274,12 +274,12 @@ class UserBulkUpdateForm(forms.ModelForm):
class Meta:
model = User
fields = ['users', 'role', 'groups', 'date_expired']
fields = ['users', 'groups', 'date_expired']
widgets = {
"groups": forms.SelectMultiple(
attrs={
'class': 'select2',
'data-placeholder': _('Select users')
'data-placeholder': _('User group')
}
)
}

View File

@ -24,9 +24,9 @@ from django.views import View
from django.views.generic.base import TemplateView
from django.db import transaction
from django.views.generic.edit import (
CreateView, UpdateView, FormMixin, FormView
CreateView, UpdateView, FormView
)
from django.views.generic.detail import DetailView, SingleObjectMixin
from django.views.generic.detail import DetailView
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth import logout as auth_logout
@ -41,7 +41,6 @@ from ..utils import generate_otp_uri, check_otp_code, \
get_user_or_tmp_user, get_password_check_rules, check_password_rules, \
is_need_unblock
from ..signals import post_user_create
from ..tasks import write_login_log_async
__all__ = [
'UserListView', 'UserCreateView', 'UserDetailView',
@ -171,7 +170,7 @@ class UserBulkUpdateView(AdminUserRequiredMixin, TemplateView):
def get_context_data(self, **kwargs):
context = {
'app': 'Assets',
'action': 'Bulk update asset',
'action': _('Bulk update user'),
'form': self.form,
'users_selected': self.id_list,
}

View File

@ -70,3 +70,4 @@ uritemplate==3.0.0
urllib3==1.22
vine==1.1.4
drf-yasg==1.9.1
Werkzeug==0.14.1