From ec6103448ea1221adb7a89febfe65365c5826c59 Mon Sep 17 00:00:00 2001 From: BaiJiangjie Date: Mon, 2 Apr 2018 12:02:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BD=BF=E7=BB=88=E7=AB=AF=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E7=9A=84=E5=BA=94=E7=94=A8=E7=94=A8=E6=88=B7=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=9C=A8=E7=94=A8=E6=88=B7=E7=BB=84=E9=87=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/users/views/group.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/users/views/group.py b/apps/users/views/group.py index 958c00ccc..1fcec8ca7 100644 --- a/apps/users/views/group.py +++ b/apps/users/views/group.py @@ -74,7 +74,7 @@ class UserGroupDetailView(AdminUserRequiredMixin, DetailView): template_name = 'users/user_group_detail.html' def get_context_data(self, **kwargs): - users = User.objects.exclude(id__in=self.object.users.all()) + users = User.objects.exclude(id__in=self.object.users.all()).exclude(role=User.ROLE_APP) context = { 'app': _('Users'), 'action': _('User group detail'), From 5b65ed8a19a3e6bc7d5a7ff09e2ec036d4c26293 Mon Sep 17 00:00:00 2001 From: BaiJiangjie Date: Mon, 2 Apr 2018 18:32:24 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E8=B5=84=E4=BA=A7=E5=88=97=E8=A1=A8IP=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=89=8D=E5=90=8E=E6=9C=89=E7=A9=BA=E6=A0=BC=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E5=AF=BC=E5=85=A5=E8=B5=84=E4=BA=A7=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=97=B6doamin=E4=BF=9D=E5=AD=98=E4=B8=BA=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/views/asset.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/assets/views/asset.py b/apps/assets/views/asset.py index e279bc0ec..45254c3a4 100644 --- a/apps/assets/views/asset.py +++ b/apps/assets/views/asset.py @@ -28,7 +28,7 @@ from common.mixins import JSONResponseMixin from common.utils import get_object_or_none, get_logger, is_uuid from common.const import create_success_msg, update_success_msg from .. import forms -from ..models import Asset, AdminUser, SystemUser, Label, Node +from ..models import Asset, AdminUser, SystemUser, Label, Node, Domain from ..hands import AdminUserRequiredMixin @@ -279,6 +279,7 @@ class BulkImportAssetView(AdminUserRequiredMixin, JSONResponseMixin, FormView): asset_dict = dict(zip(attr, row)) id_ = asset_dict.pop('id', 0) for k, v in asset_dict.items(): + v = v.strip() if k == 'is_active': v = True if v in ['TRUE', 1, 'true'] else False elif k == 'admin_user': @@ -288,8 +289,8 @@ class BulkImportAssetView(AdminUserRequiredMixin, JSONResponseMixin, FormView): v = int(v) except ValueError: v = 0 - else: - continue + elif k == 'domain': + v = get_object_or_none(Domain, name=v) asset_dict[k] = v asset = get_object_or_none(Asset, id=id_) if is_uuid(id_) else None