From 98757aa428728b58ca0f906d3ae603888b65d4fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E4=B8=96=E5=B3=B0?= <93648765@qq.com> Date: Mon, 19 Sep 2016 17:25:41 +0800 Subject: [PATCH] update assets_group --- apps/assets/forms.py | 17 ++-- apps/assets/models.py | 5 +- .../assets/templates/assets/asset_create.html | 2 +- .../templates/assets/asset_group_create.html | 81 ++++++++++++------ .../templates/assets/asset_group_detail.html | 2 +- .../templates/assets/asset_group_list.html | 2 +- .../templates/assets/idc_create_update.html | 81 ++++++++++-------- apps/assets/templates/assets/idc_list.html | 50 +++-------- apps/assets/views.py | 33 +++++-- apps/jumpserver/settings.py | 13 ++- apps/static/css/style.css | 1 + apps/static/jbox/Skins/jumpserver/Desktop.ini | 3 - .../jbox/Skins/jumpserver/images/Thumbs.db | Bin 19456 -> 0 bytes .../Skins/jumpserver/images/jbox-button1.png | Bin 338 -> 0 bytes .../Skins/jumpserver/images/jbox-button2.png | Bin 314 -> 0 bytes .../Skins/jumpserver/images/jbox-close1.gif | Bin 1221 -> 0 bytes .../Skins/jumpserver/images/jbox-close2.gif | Bin 791 -> 0 bytes .../images/jbox-content-loading.gif | Bin 10810 -> 0 bytes .../jumpserver/images/jbox-icons-ie6.gif | Bin 2767 -> 0 bytes .../Skins/jumpserver/images/jbox-icons.png | Bin 6588 -> 0 bytes .../Skins/jumpserver/images/jbox-loading1.gif | Bin 3199 -> 0 bytes .../Skins/jumpserver/images/jbox-loading2.gif | Bin 4167 -> 0 bytes .../Skins/jumpserver/images/jbox-loading3.gif | Bin 8778 -> 0 bytes .../jumpserver/images/jbox-title-icon.gif | Bin 73 -> 0 bytes apps/static/jbox/Skins/jumpserver/jbox.css | 43 ---------- .../static/jbox/Skins2/jumpserver/Desktop.ini | 3 - .../jbox/Skins2/jumpserver/images/Thumbs.db | Bin 33792 -> 0 bytes .../Skins2/jumpserver/images/jbox-close1.gif | Bin 1221 -> 0 bytes .../Skins2/jumpserver/images/jbox-close2.gif | Bin 791 -> 0 bytes .../images/jbox-content-loading.gif | Bin 10810 -> 0 bytes .../jumpserver/images/jbox-icons-ie6.gif | Bin 2767 -> 0 bytes .../Skins2/jumpserver/images/jbox-icons.png | Bin 6663 -> 0 bytes .../jumpserver/images/jbox-loading1.gif | Bin 3199 -> 0 bytes .../jumpserver/images/jbox-loading2.gif | Bin 4167 -> 0 bytes .../jumpserver/images/jbox-loading3.gif | Bin 8778 -> 0 bytes .../jumpserver/images/jbox-title-icon.gif | Bin 73 -> 0 bytes apps/static/jbox/Skins2/jumpserver/jbox.css | 41 --------- apps/static/jbox/i18n/jquery.jBox-zh-CN.js | 77 ----------------- apps/static/jbox/jquery-migrate-1.1.1.min.js | 9 -- apps/static/jbox/jquery.jBox-2.3.min.js | 11 --- apps/templates/_head_css_js.html | 5 -- 41 files changed, 168 insertions(+), 311 deletions(-) delete mode 100644 apps/static/jbox/Skins/jumpserver/Desktop.ini delete mode 100644 apps/static/jbox/Skins/jumpserver/images/Thumbs.db delete mode 100644 apps/static/jbox/Skins/jumpserver/images/jbox-button1.png delete mode 100644 apps/static/jbox/Skins/jumpserver/images/jbox-button2.png delete mode 100644 apps/static/jbox/Skins/jumpserver/images/jbox-close1.gif delete mode 100644 apps/static/jbox/Skins/jumpserver/images/jbox-close2.gif delete mode 100644 apps/static/jbox/Skins/jumpserver/images/jbox-content-loading.gif delete mode 100644 apps/static/jbox/Skins/jumpserver/images/jbox-icons-ie6.gif delete mode 100644 apps/static/jbox/Skins/jumpserver/images/jbox-icons.png delete mode 100644 apps/static/jbox/Skins/jumpserver/images/jbox-loading1.gif delete mode 100644 apps/static/jbox/Skins/jumpserver/images/jbox-loading2.gif delete mode 100644 apps/static/jbox/Skins/jumpserver/images/jbox-loading3.gif delete mode 100644 apps/static/jbox/Skins/jumpserver/images/jbox-title-icon.gif delete mode 100644 apps/static/jbox/Skins/jumpserver/jbox.css delete mode 100644 apps/static/jbox/Skins2/jumpserver/Desktop.ini delete mode 100644 apps/static/jbox/Skins2/jumpserver/images/Thumbs.db delete mode 100644 apps/static/jbox/Skins2/jumpserver/images/jbox-close1.gif delete mode 100644 apps/static/jbox/Skins2/jumpserver/images/jbox-close2.gif delete mode 100644 apps/static/jbox/Skins2/jumpserver/images/jbox-content-loading.gif delete mode 100644 apps/static/jbox/Skins2/jumpserver/images/jbox-icons-ie6.gif delete mode 100644 apps/static/jbox/Skins2/jumpserver/images/jbox-icons.png delete mode 100644 apps/static/jbox/Skins2/jumpserver/images/jbox-loading1.gif delete mode 100644 apps/static/jbox/Skins2/jumpserver/images/jbox-loading2.gif delete mode 100644 apps/static/jbox/Skins2/jumpserver/images/jbox-loading3.gif delete mode 100644 apps/static/jbox/Skins2/jumpserver/images/jbox-title-icon.gif delete mode 100644 apps/static/jbox/Skins2/jumpserver/jbox.css delete mode 100644 apps/static/jbox/i18n/jquery.jBox-zh-CN.js delete mode 100644 apps/static/jbox/jquery-migrate-1.1.1.min.js delete mode 100644 apps/static/jbox/jquery.jBox-2.3.min.js diff --git a/apps/assets/forms.py b/apps/assets/forms.py index 4b2040e5f..94d504726 100644 --- a/apps/assets/forms.py +++ b/apps/assets/forms.py @@ -17,7 +17,7 @@ class AssetForm(forms.ModelForm): widgets = { 'groups': forms.SelectMultiple(attrs={'class': 'select2-groups', 'data-placeholder': _('Select asset groups')}), - 'system_user': forms.SelectMultiple(attrs={'class': 'select2-system-user', 'data-placeholder': _('Select asset system user')}), + 'system_users': forms.SelectMultiple(attrs={'class': 'select2-system-user', 'data-placeholder': _('Select asset system user')}), # 'admin_user': forms.SelectMultiple(attrs={'class': 'select2-admin-user', 'data-placeholder': _('Select asset admin user')}), } @@ -46,8 +46,13 @@ class AssetGroupForm(forms.ModelForm): class Meta: model = AssetGroup fields = [ - "name", "comment" + "name", "comment","system_users" ] + widgets = { + 'name' : forms.TextInput(attrs={}), + 'system_users': forms.SelectMultiple(attrs={'class': 'select2-system-user', 'data-placeholder': _('Select asset system user')}), + + } help_texts = { 'name': '* required', } @@ -76,11 +81,13 @@ class IDCForm(forms.ModelForm): class Meta: model = IDC - fields = ['name', "bandwidth", "operator", 'contact', 'phone', 'address', 'network', 'comment'] + fields = ['name', "bandwidth", "operator", 'contact', 'phone', 'address', 'intranet', 'extranet','comment'] widgets = { 'name': forms.TextInput(attrs={'placeholder': _('Name')}), - 'network': forms.Textarea( - attrs={'placeholder': '192.168.1.0/24\n192.168.2.0/24'}) + 'intranet': forms.Textarea( + attrs={'placeholder': 'IP段之间用逗号隔开,如:192.168.1.0/24,192.168.1.0/24'}), + 'extranet': forms.Textarea( + attrs={'placeholder': 'IP段之间用逗号隔开,如:201.1.32.1/24,202.2.32.1/24'}) } diff --git a/apps/assets/models.py b/apps/assets/models.py index 2d66992a3..27f35d9a0 100644 --- a/apps/assets/models.py +++ b/apps/assets/models.py @@ -16,7 +16,8 @@ class IDC(models.Model): contact = models.CharField(max_length=16, blank=True, verbose_name=_('Contact')) phone = models.CharField(max_length=32, blank=True, verbose_name=_('Phone')) address = models.CharField(max_length=128, blank=True, verbose_name=_("Address")) - network = models.TextField(blank=True, verbose_name=_('Network')) + intranet = models.TextField(blank=True, verbose_name=_('Intranet')) + extranet = models.TextField(blank=True, verbose_name=_('Extranet')) date_created = models.DateTimeField(auto_now=True, null=True, verbose_name=_('Date added')) operator = models.CharField(max_length=32, blank=True, verbose_name=_('Operator')) created_by = models.CharField(max_length=32, blank=True, verbose_name=_('Created by')) @@ -235,7 +236,7 @@ class SystemUser(models.Model): class AssetGroup(models.Model): name = models.CharField(max_length=64, unique=True, verbose_name=_('Name')) - system_users = models.ManyToManyField(SystemUser, related_name='asset_groups', blank=True) + system_users = models.ManyToManyField(SystemUser, related_name='system_users', blank=True) created_by = models.CharField(max_length=32, blank=True, verbose_name=_('Created by')) date_created = models.DateTimeField(auto_now=True, null=True, verbose_name=_('Date added')) comment = models.TextField(blank=True, verbose_name=_('Comment')) diff --git a/apps/assets/templates/assets/asset_create.html b/apps/assets/templates/assets/asset_create.html index f47cfb880..3ab050155 100644 --- a/apps/assets/templates/assets/asset_create.html +++ b/apps/assets/templates/assets/asset_create.html @@ -58,7 +58,7 @@
Tips: 管理用户是服务器存在的root或拥有sudo的用户,用来推送系统用户
- {{ form.system_user|bootstrap_horizontal }} + {{ form.system_users|bootstrap_horizontal }}