Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
b95c1dee
Commit
b95c1dee
authored
Sep 17, 2016
by
wangyong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
alter asset add and detail
parent
42012d7b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
320 additions
and
442 deletions
+320
-442
forms.py
apps/assets/forms.py
+4
-2
models.py
apps/assets/models.py
+20
-31
asset_create.html
apps/assets/templates/assets/asset_create.html
+53
-49
asset_detail.html
apps/assets/templates/assets/asset_detail.html
+226
-354
asset_list.html
apps/assets/templates/assets/asset_list.html
+1
-1
views.py
apps/assets/views.py
+14
-5
style.css
apps/static/css/style.css
+2
-0
No files found.
apps/assets/forms.py
View file @
b95c1dee
...
@@ -12,11 +12,13 @@ class AssetForm(forms.ModelForm):
...
@@ -12,11 +12,13 @@ class AssetForm(forms.ModelForm):
fields
=
[
fields
=
[
"ip"
,
"other_ip"
,
"remote_card_ip"
,
"hostname"
,
"port"
,
"groups"
,
"username"
,
"password"
,
"ip"
,
"other_ip"
,
"remote_card_ip"
,
"hostname"
,
"port"
,
"groups"
,
"username"
,
"password"
,
"idc"
,
"mac_address"
,
"brand"
,
"cpu"
,
"memory"
,
"disk"
,
"os"
,
"cabinet_no"
,
"cabinet_pos"
,
"idc"
,
"mac_address"
,
"brand"
,
"cpu"
,
"memory"
,
"disk"
,
"os"
,
"cabinet_no"
,
"cabinet_pos"
,
"number"
,
"status"
,
"type"
,
"env"
,
"sn"
,
"is_active"
,
"comment"
"number"
,
"status"
,
"type"
,
"env"
,
"sn"
,
"is_active"
,
"comment"
,
"admin_user"
,
"system_user"
]
]
widgets
=
{
widgets
=
{
'groups'
:
forms
.
SelectMultiple
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Select asset groups'
)}),
'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'
)}),
# 'admin_user': forms.SelectMultiple(attrs={'class': 'select2-admin-user', 'data-placeholder': _('Select asset admin user')}),
}
}
...
...
apps/assets/models.py
View file @
b95c1dee
...
@@ -7,18 +7,6 @@ from django.utils.translation import ugettext_lazy as _
...
@@ -7,18 +7,6 @@ from django.utils.translation import ugettext_lazy as _
from
common.utils
import
encrypt
,
decrypt
from
common.utils
import
encrypt
,
decrypt
class
AssetGroup
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
64
,
unique
=
True
,
verbose_name
=
_
(
'Name'
))
created_by
=
models
.
CharField
(
max_length
=
32
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Created by'
))
comment
=
models
.
TextField
(
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Comment'
))
def
__unicode__
(
self
):
return
self
.
name
class
Meta
:
db_table
=
'asset_group'
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -66,8 +54,8 @@ class IDC(models.Model):
...
@@ -66,8 +54,8 @@ class IDC(models.Model):
class
AssetExtend
(
models
.
Model
):
class
AssetExtend
(
models
.
Model
):
key
=
models
.
CharField
(
max_length
=
64
,
verbose_name
=
_
(
'KEY'
))
key
=
models
.
CharField
(
max_length
=
64
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'KEY'
))
value
=
models
.
CharField
(
max_length
=
64
,
verbose_name
=
_
(
'VALUE'
))
value
=
models
.
CharField
(
max_length
=
64
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'VALUE'
))
created_by
=
models
.
CharField
(
max_length
=
32
,
blank
=
True
,
verbose_name
=
_
(
"Created by"
))
created_by
=
models
.
CharField
(
max_length
=
32
,
blank
=
True
,
verbose_name
=
_
(
"Created by"
))
date_created
=
models
.
DateTimeField
(
auto_now
=
True
,
null
=
True
,
blank
=
True
)
date_created
=
models
.
DateTimeField
(
auto_now
=
True
,
null
=
True
,
blank
=
True
)
comment
=
models
.
TextField
(
blank
=
True
,
verbose_name
=
_
(
'Comment'
))
comment
=
models
.
TextField
(
blank
=
True
,
verbose_name
=
_
(
'Comment'
))
...
@@ -272,14 +260,14 @@ class Asset(models.Model):
...
@@ -272,14 +260,14 @@ class Asset(models.Model):
other_ip
=
models
.
CharField
(
max_length
=
255
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Other IP'
))
other_ip
=
models
.
CharField
(
max_length
=
255
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Other IP'
))
remote_card_ip
=
models
.
CharField
(
max_length
=
16
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Remote card IP'
))
remote_card_ip
=
models
.
CharField
(
max_length
=
16
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Remote card IP'
))
hostname
=
models
.
CharField
(
max_length
=
128
,
unique
=
True
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Hostname'
))
hostname
=
models
.
CharField
(
max_length
=
128
,
unique
=
True
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Hostname'
))
port
=
models
.
IntegerField
(
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Port'
))
port
=
models
.
IntegerField
(
default
=
22
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Port'
))
groups
=
models
.
ManyToManyField
(
AssetGroup
,
related_name
=
'assets'
,
verbose_name
=
_
(
'Asset groups'
))
groups
=
models
.
ManyToManyField
(
AssetGroup
,
blank
=
True
,
related_name
=
'assets'
,
verbose_name
=
_
(
'Asset groups'
))
username
=
models
.
CharField
(
max_length
=
16
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Admin user'
))
username
=
models
.
CharField
(
max_length
=
16
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Admin user'
))
password
=
models
.
CharField
(
max_length
=
256
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
"Admin password"
))
password
=
models
.
CharField
(
max_length
=
256
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
"Admin password"
))
admin_user
=
models
.
ForeignKey
(
AdminUser
,
null
=
True
,
related_name
=
'assets'
,
admin_user
=
models
.
ForeignKey
(
AdminUser
,
null
=
True
,
blank
=
True
,
related_name
=
'assets'
,
on_delete
=
models
.
SET_NULL
,
verbose_name
=
_
(
"Admin user"
))
on_delete
=
models
.
SET_NULL
,
verbose_name
=
_
(
"Admin user"
))
system_user
=
models
.
ManyToManyField
(
SystemUser
,
blank
=
True
,
related_name
=
'assets'
,
verbose_name
=
_
(
"System User"
))
system_user
=
models
.
ManyToManyField
(
SystemUser
,
blank
=
True
,
related_name
=
'assets'
,
verbose_name
=
_
(
"System User"
))
idc
=
models
.
ForeignKey
(
IDC
,
null
=
True
,
related_name
=
'assets'
,
on_delete
=
models
.
SET_NULL
,
verbose_name
=
_
(
'IDC'
))
idc
=
models
.
ForeignKey
(
IDC
,
null
=
True
,
blank
=
True
,
related_name
=
'assets'
,
on_delete
=
models
.
SET_NULL
,
verbose_name
=
_
(
'IDC'
))
mac_address
=
models
.
CharField
(
max_length
=
20
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
"Mac address"
))
mac_address
=
models
.
CharField
(
max_length
=
20
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
"Mac address"
))
brand
=
models
.
CharField
(
max_length
=
64
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Brand'
))
brand
=
models
.
CharField
(
max_length
=
64
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Brand'
))
cpu
=
models
.
CharField
(
max_length
=
64
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'CPU'
))
cpu
=
models
.
CharField
(
max_length
=
64
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'CPU'
))
...
@@ -288,15 +276,15 @@ class Asset(models.Model):
...
@@ -288,15 +276,15 @@ class Asset(models.Model):
os
=
models
.
CharField
(
max_length
=
128
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'OS'
))
os
=
models
.
CharField
(
max_length
=
128
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'OS'
))
cabinet_no
=
models
.
CharField
(
max_length
=
32
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Cabinet number'
))
cabinet_no
=
models
.
CharField
(
max_length
=
32
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Cabinet number'
))
cabinet_pos
=
models
.
IntegerField
(
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Cabinet position'
))
cabinet_pos
=
models
.
IntegerField
(
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Cabinet position'
))
number
=
models
.
CharField
(
max_length
=
32
,
blank
=
True
,
verbose_name
=
_
(
'Asset number'
))
number
=
models
.
CharField
(
max_length
=
32
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Asset number'
))
status
=
models
.
ForeignKey
(
AssetExtend
,
null
=
True
,
blank
=
True
,
status
=
models
.
ForeignKey
(
AssetExtend
,
null
=
True
,
blank
=
True
,
related_name
=
"asset_status_extend"
,
related_name
=
"asset_status_extend"
,
verbose_name
=
_
(
'Asset status'
))
verbose_name
=
_
(
'Asset status'
))
type
=
models
.
ForeignKey
(
AssetExtend
,
null
=
True
,
blank
=
True
,
type
=
models
.
ForeignKey
(
AssetExtend
,
null
=
True
,
blank
=
True
,
related_name
=
"asset_type_extend"
,
related_name
=
"asset_type_extend"
,
verbose_name
=
_
(
'Asset type'
))
verbose_name
=
_
(
'Asset type'
))
env
=
models
.
ForeignKey
(
AssetExtend
,
null
=
True
,
blank
=
True
,
env
=
models
.
ForeignKey
(
AssetExtend
,
null
=
True
,
blank
=
True
,
related_name
=
"asset_env_extend"
,
related_name
=
"asset_env_extend"
,
verbose_name
=
_
(
'Asset environment'
))
verbose_name
=
_
(
'Asset environment'
))
sn
=
models
.
CharField
(
max_length
=
128
,
blank
=
True
,
verbose_name
=
_
(
'Serial number'
))
sn
=
models
.
CharField
(
max_length
=
128
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Serial number'
))
created_by
=
models
.
CharField
(
max_length
=
32
,
blank
=
True
,
verbose_name
=
_
(
'Created by'
))
created_by
=
models
.
CharField
(
max_length
=
32
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Created by'
))
is_active
=
models
.
BooleanField
(
default
=
True
,
verbose_name
=
_
(
'Is active'
))
is_active
=
models
.
BooleanField
(
default
=
True
,
verbose_name
=
_
(
'Is active'
))
date_created
=
models
.
DateTimeField
(
auto_now
=
True
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Date added'
))
date_created
=
models
.
DateTimeField
(
auto_now
=
True
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Date added'
))
comment
=
models
.
CharField
(
max_length
=
128
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Comment'
))
comment
=
models
.
CharField
(
max_length
=
128
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Comment'
))
...
@@ -332,15 +320,15 @@ class Asset(models.Model):
...
@@ -332,15 +320,15 @@ class Asset(models.Model):
class
Label
(
models
.
Model
):
class
Label
(
models
.
Model
):
key
=
models
.
CharField
(
max_length
=
64
,
verbose_name
=
_
(
'KEY'
))
key
=
models
.
CharField
(
max_length
=
64
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'KEY'
))
value
=
models
.
CharField
(
max_length
=
64
,
verbose_name
=
_
(
'VALUE'
))
value
=
models
.
CharField
(
max_length
=
64
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'VALUE'
))
asset
=
models
.
ForeignKey
(
Asset
,
null
=
True
,
blank
=
True
,
on_delete
=
models
.
SET_NULL
,
verbose_name
=
_
(
'Asset'
))
asset
=
models
.
ForeignKey
(
Asset
,
null
=
True
,
blank
=
True
,
on_delete
=
models
.
SET_NULL
,
verbose_name
=
_
(
'Asset'
))
created_by
=
models
.
CharField
(
max_length
=
32
,
blank
=
True
,
verbose_name
=
_
(
"Created by"
))
created_by
=
models
.
CharField
(
max_length
=
32
,
blank
=
True
,
verbose_name
=
_
(
"Created by"
))
date_created
=
models
.
DateTimeField
(
auto_now
=
True
,
null
=
True
)
date_created
=
models
.
DateTimeField
(
auto_now
=
True
,
null
=
True
)
comment
=
models
.
CharField
(
max_length
=
128
,
blank
=
True
,
verbose_name
=
_
(
'Comment'
))
comment
=
models
.
CharField
(
max_length
=
128
,
blank
=
True
,
verbose_name
=
_
(
'Comment'
))
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
name
return
self
.
key
class
Meta
:
class
Meta
:
db_table
=
'label'
db_table
=
'label'
...
@@ -348,4 +336,4 @@ class Label(models.Model):
...
@@ -348,4 +336,4 @@ class Label(models.Model):
def
generate_fake
():
def
generate_fake
():
for
cls
in
(
Asset
,
AssetGroup
,
IDC
):
for
cls
in
(
Asset
,
AssetGroup
,
IDC
):
cls
.
generate_fake
()
cls
.
generate_fake
()
\ No newline at end of file
apps/assets/templates/assets/asset_create.html
View file @
b95c1dee
...
@@ -27,67 +27,68 @@
...
@@ -27,67 +27,68 @@
<div
class=
"ibox-content"
>
<div
class=
"ibox-content"
>
<div
class=
"panel blank-panel"
>
<div
class=
"panel blank-panel"
>
<div
class=
"panel-body"
>
<div
class=
"tab-content"
>
<div
class=
"tab-content"
>
<form
id=
"assetForm"
method=
"post"
class=
"form-horizontal"
>
<div
id=
"tab-1"
class=
"ibox float-e-margins tab-pane active"
></div>
{% csrf_token %}
<form
id=
"assetForm"
method=
"post"
class=
"form-horizontal"
>
<h3
class=
"widget-head-color-box"
>
基本信息
</h3>
{% csrf_token %}
<h3
class=
"widget-head-color-box"
>
基本信息
</h3>
{{ form.hostname|bootstrap_horizontal }}
{{ form.hostname|bootstrap_horizontal }}
{{ form.ip|bootstrap_horizontal }}
{{ form.ip|bootstrap_horizontal }}
{{ form.port|bootstrap_horizontal }}
{{ form.port|bootstrap_horizontal }}
{{ form.type|bootstrap_horizontal }}
{{ form.type|bootstrap_horizontal }}
{{ form.comment|bootstrap_horizontal }}
{{ form.comment|bootstrap_horizontal }}
<div
class=
"hr-line-dashed"
></div>
<h3>
关联资产用户
</h3>
<div
class=
"form-group"
>
<label
for=
"j_group"
class=
"col-sm-2 control-label"
>
管理用户
</label>
<div
class=
"col-sm-9"
>
<div
class=
"radio i-checks"
>
<label><input
type=
"radio"
checked=
"checked"
id=
"id_use_default_auth"
name=
"use_default_auth"
><span>
使用预定义管理用户
</span></label>
<label><input
type=
"radio"
id=
"id_use_default_auth"
name=
"use_default_auth"
><span>
自定义
</span></label>
</div>
</div>
</div>
<div
class=
"form-group"
id=
"id_manager_user"
>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"col-sm-offset-2 col-sm-9"
>
<h3>
关联资产用户
</h3>
<input
type=
"text"
placeholder=
"请选择管理用户"
name=
"manager_user"
class=
"form-control"
>
<div
class=
"form-group"
>
</div>
<label
for=
"j_group"
class=
"col-sm-2 control-label"
>
管理用户
</label>
<div
class=
"col-sm-9"
>
<div
class=
"radio i-checks"
>
<label><input
type=
"radio"
checked=
"checked"
id=
"id_use_default_auth"
name=
"use_default_auth"
><span>
使用预定义管理用户
</span></label>
<label><input
type=
"radio"
id=
"id_use_default_auth"
name=
"use_default_auth"
><span>
自定义
</span></label>
</div>
</div>
<p
class=
"col-sm-offset-2"
>
Tips: 管理用户是服务器存在的root或拥有sudo的用户,用来推送系统用户
</p>
</div>
</div>
<div
class=
"form-group"
>
{{ form.admin_user|bootstrap_horizontal }}
<label
for=
"system_user"
class=
"col-sm-2 control-label"
>
系统用户
</label>
<p
class=
"col-sm-offset-2"
>
Tips: 管理用户是服务器存在的root或拥有sudo的用户,用来推送系统用户
</p>
<div
class=
"col-sm-9"
>
<input
type=
"text"
placeholder=
""
name=
"system_user"
class=
"form-control"
>
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"hr-line-dashed"
></div>
<h3>
所属
</h3>
{{ form.system_user|bootstrap_horizontal }}
{{ form.idc|bootstrap_horizontal }}
{{ form.groups|bootstrap_horizontal }}
<div
class=
"hr-line-dashed"
></div>
<h3>
所属
</h3>
{{ form.idc|bootstrap_horizontal }}
<div
class=
"hr-line-dashed"
></div>
{{ form.groups|bootstrap_horizontal }}
<h3>
标签
</h3>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<h3>
标签
</h3>
<div
class=
"col-sm-4 col-sm-offset-5"
>
<div
class=
"form-group"
id=
"id_label"
>
<button
class=
"btn btn-white"
type=
"reset"
>
重置
</button>
<label
class=
"col-sm-2 control-label"
>
Label
</label>
<button
class=
"btn btn-primary"
type=
"submit"
>
提交
</button>
<div
class=
"col-sm-4"
>
</div>
<input
type=
"text"
placeholder=
"Key"
name=
"key"
class=
"form-control"
>
</div>
</div>
</form>
<div
class=
"col-sm-5"
>
<input
type=
"text"
placeholder=
"Value"
name=
"value"
class=
"form-control"
>
</div>
</div>
<div
class=
"col-sm-offset-2"
>
<i
class=
"fa fa-plus-circle"
></i>
<span
class=
"nav-label"
>
添加
</span><span
class=
"fa arrow"
></span>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<div
class=
"col-sm-4 col-sm-offset-5"
>
<button
class=
"btn btn-white"
type=
"reset"
>
重置
</button>
<button
class=
"btn btn-primary"
type=
"submit"
>
提交
</button>
</div>
</div>
</div>
</
div
>
</
form
>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -100,7 +101,9 @@
...
@@ -100,7 +101,9 @@
{% block custom_foot_js %}
{% block custom_foot_js %}
<script>
<script>
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
$
(
'.select2'
).
select2
();
$
(
'.select2-groups'
).
select2
();
$
(
'.select2-admin-user'
).
select2
();
$
(
'.select2-system-user'
).
select2
();
})
})
</script>
</script>
{% endblock %}
{% endblock %}
\ No newline at end of file
apps/assets/templates/assets/asset_detail.html
View file @
b95c1dee
{% extends 'base.html' %}
{% extends 'base.html' %}
{% load common_tags %}
{% load static %}
{% load i18n %}
{% block custom_head_css_js %}
<link
href=
"{% static "
css
/
plugins
/
select2
/
select2
.
min
.
css
"
%}"
rel=
"stylesheet"
>
<link
href=
"{% static "
css
/
plugins
/
sweetalert
/
sweetalert
.
css
"
%}"
rel=
"stylesheet"
>
<script
src=
"{% static "
js
/
plugins
/
select2
/
select2
.
full
.
min
.
js
"
%}"
></script>
<script
src=
"{% static "
js
/
plugins
/
sweetalert
/
sweetalert
.
min
.
js
"
%}"
></script>
{% endblock %}
{% block content %}
{% block content %}
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-sm-
4
"
>
<div
class=
"col-sm-
12
"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<div
class=
"panel-options"
>
<span
class=
"text text-primary"
><b>
{{ asset.ip }}
</b></span>
<ul
class=
"nav nav-tabs"
>
<div
class=
"ibox-tools"
>
<li
class=
"active"
><a
href=
""
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Asset detail' %}
</a>
{#
<a
class=
""
href=
"{% url 'assets:asset-update' %}"
>
#}
</li>
<i
class=
"fa fa-refresh"
></i>
<li><a
href=
""
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
{% trans 'Asset users' %}
</a></li>
</a>
<li><a
href=
""
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
{% trans 'Asset login log' %}
</a></li>
<a
class=
"collapse-link"
>
</ul>
<i
class=
"fa fa-chevron-up"
></i>
</a>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<ul
class=
"dropdown-menu dropdown-user"
>
</ul>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
</div>
<div
class=
"ibox-content ibox-heading"
>
<div
class=
"tab-content"
>
<h3>
主机详细信息
</h3>
<div
class=
"col-sm-7"
style=
"padding-left: 0"
>
<small><i
class=
"fa fa-map-marker"
></i>
此主机详细信息.
</small>
<div
class=
"ibox float-e-margins"
>
</div>
<div
class=
"ibox-title"
>
<div
class=
"ibox-content"
>
<span
class=
"label"
><b>
{{ asset.hostname }}
</b></span>
<div>
<div
class=
"ibox-tools"
>
<div
class=
"text-left"
>
<a
class=
"collapse-link"
>
<table
class=
"table"
>
<i
class=
"fa fa-chevron-up"
></i>
<tr>
</a>
<td
class=
"text-navy"
>
主机名
</td>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<td>
{{ asset.hostname|default_if_none:"" }}
</td>
<i
class=
"fa fa-wrench"
></i>
</tr>
</a>
<tr>
<ul
class=
"dropdown-menu dropdown-user"
>
<td
class=
"text-navy"
>
IP
</td>
</ul>
<td>
{{ asset.ip|default_if_none:"" }}
</td>
<a
class=
"close-link"
>
</tr>
<i
class=
"fa fa-times"
></i>
<tr>
</a>
<td
class=
"text-navy"
>
其他IP
</td>
</div>
<td>
</div>
<table
class=
"table"
>
<div
class=
"ibox-content"
>
{% if asset.other_ip %}
<table
class=
"table"
>
{% for ip in asset.other_ip %}
<tbody>
<tr>
<tr
class=
"no-borders-tr"
>
<td>
{{ ip }}
</td>
{#
<td
colspan=
"2"
>
#}
</tr>
{#
<img
src=
"{{ asset | user_avatar_url }}"
class=
"img-circle"
width=
"64"
height=
"64"
>
#}
{% endfor %}
{#
</td>
#}
{% endif %}
</tr>
</table>
<tr>
</td>
<td
width=
"20%"
>
{% trans 'Hostname' %}:
</td>
</tr>
<td><b>
{{ asset.hostname }}
</b></td>
<tr>
</tr>
<td
class=
"text-navy"
>
远控IP
</td>
<tr>
<td>
{{ asset.remote_ip|default_if_none:"" }}
</td>
<td>
{% trans 'IP' %}:
</td>
</tr>
<td><b>
{{ asset.ip }}
</b></td>
<tr>
</tr>
<td
class=
"text-navy"
>
端口
</td>
<tr>
<td>
{{ asset.port|default_if_none:"" }}
</td>
<td>
{% trans 'Other IP' %}:
</td>
</tr>
<td><b>
{{ asset.other_ip }}
</b></td>
</tr>
<tr>
<tr>
<td
class=
"text-navy"
>
主机组
</td>
<td>
{% trans 'Remote card IP' %}:
</td>
<td>
<td><b>
{{ asset.remote_card_ip }}
</b></td>
<table
class=
"table"
>
</tr>
{% for asset_group in asset.group.all %}
<tr>
<tr>
<td>
{% trans 'Port' %}:
</td>
<td>
{{ asset_group.name|default_if_none:"" }}
</td>
<td><b>
{{ asset.port }}
</b></td>
</tr>
</tr>
{% endfor %}
<tr>
</table>
<td>
{% trans 'Mac address' %}:
</td>
</td>
<td><b>
{{ asset.mac_addr }}
</b></td>
</tr>
</tr>
<tr>
<tr>
<td
class=
"text-navy"
>
使用默认管理账号
</td>
<td>
{% trans 'CPU' %}:
</td>
{#
<td>
{{ asset.use_default_auth|bool2str }}
</td>
#}
<td><b>
{{ asset.cpu }}
</b></td>
{#
<td>
{{ asset.use_default_auth|bool2str }} {% if not asset.use_default_auth %}
<span
class=
"text-info"
>
{{ asset.username }}
</span>
{% endif %}
</td>
#}
</tr>
</tr>
<tr>
<tr>
<td>
{% trans 'Memory' %}:
</td>
<td
class=
"text-navy"
>
机房
</td>
<td><b>
{{ asset.memory }}
</b></td>
<td>
{{ asset.idc.name|default_if_none:"" }}
</td>
</tr>
</tr>
<tr>
<tr>
<td>
{% trans 'Disk' %}:
</td>
<td
class=
"text-navy"
>
硬件厂商型号
</td>
<td><b>
{{ asset.disk }}
</b></td>
<td>
{{ asset.brand|default_if_none:"" }}
</td>
</tr>
</tr>
<tr>
<tr>
<td>
{% trans 'Label' %}:
</td>
<td
class=
"text-navy"
>
CPU
</td>
{% for label in asset.label_set.all %}
<td>
{{ asset.cpu|default_if_none:"" }}
</td>
<td><b>
{{ label.key }} - {{ label.value }}
</b></td>
</tr>
{% endfor %}
<tr>
</tr>
<td
class=
"text-navy"
>
内存
</td>
<tr>
<td>
{{ asset.memory|default_if_none:"" }}{% if asset.memory %}G{% endif %}
</td>
<td>
{% trans 'OS' %}:
</td>
</tr>
<td><b>
{{ asset.os }}
</b></td>
<tr>
</tr>
<td
class=
"text-navy"
>
硬盘
</td>
<tr>
<td>
<td>
{% trans 'Mac address' %}:
</td>
<table
class=
"table"
>
<td><b>
{{ asset.mac_addr }}
</b></td>
{% if asset.disk %}
</tr>
{% for disk, value in asset.disk %}
<tr>
<tr>
<td>
{% trans 'Asset status' %}:
</td>
<td><span
class=
"text-navy"
>
{{ disk|default_if_none:"" }}
</span>
&
nbsp
&
nbsp
&
nbsp {{ value|default_if_none:"" }}
</td>
<td><b>
{{ asset.status }}
</b></td>
</tr>
</tr>
{% endfor %}
<tr>
{% endif %}
<td>
{% trans 'Is active' %}:
</td>
</table>
<td><b>
{{ asset.is_active }}
</b></td>
</td>
</tr>
</tr>
<tr>
<tr>
<td>
{% trans 'Asset type' %}:
</td>
<td
class=
"text-navy"
>
资产编号
</td>
<td><b>
{{ asset.type }}
</b></td>
<td>
{{ asset.number|default_if_none:"" }}
</td>
</tr>
</tr>
<tr>
<tr>
<td>
{% trans 'Asset environment' %}:
</td>
<td
class=
"text-navy"
>
SN
</td>
<td><b>
{{ asset.env }}
</b></td>
<td>
{{ asset.sn|default_if_none:"" }}
</td>
</tr>
</tr>
<tr>
<tr>
<td>
{% trans 'Serial number' %}:
</td>
<td
class=
"text-navy"
>
主机类型
</td>
<td><b>
{{ asset.sn }}
</b></td>
<td>
{{ asset.get_asset_type_display|default_if_none:"" }}
</td>
</tr>
</tr>
<tr>
<tr>
<td>
{% trans 'Asset number' %}:
</td>
<td
class=
"text-navy"
>
系统版本
</td>
<td><b>
{{ asset.number }}
</b></td>
<td>
{{ asset.system_type|default_if_none:"" }} {{ asset.system_version|default_if_none:"" }}
</td>
</tr>
</tr>
<tr>
<tr>
<td>
{% trans 'Created by' %}:
</td>
<td
class=
"text-navy"
>
系统平台
</td>
<td><b>
{{ asset.created_by }}
</b></td>
<td>
{{ asset.system_arch|default_if_none:"" }}
</td>
</tr>
</tr>
<tr>
<tr>
<td>
{% trans 'Date joined' %}:
</td>
<td
class=
"text-navy"
>
运行环境
</td>
<td><b>
{{ asset.date_joined|date:"Y-m-j H:i:s" }}
</b></td>
<td>
{{ asset.get_env_display|default_if_none:"" }}
</td>
</tr>
</tr>
<tr>
<tr>
<td>
{% trans 'Comment' %}:
</td>
<td
class=
"text-navy"
>
机器状态
</td>
<td><b>
{{ asset.comment }}
</b></td>
<td>
{{ asset.get_status_display|default_if_none:"" }}
</td>
</tr>
</tr>
</tbody>
<tr>
</table>
<td
class=
"text-navy"
>
机柜号
</td>
</div>
<td>
{{ asset.cabinet|default_if_none:"" }}
</td>
</tr>
<tr>
<td
class=
"text-navy"
>
机柜位置
</td>
<td>
{{ asset.position|default_if_none:"" }}
</td>
</tr>
<tr>
<td
class=
"text-navy"
>
激活
</td>
<td>
{{ asset.is_active }}
</td>
</tr>
<tr>
<td
class=
"text-navy"
>
添加日期
</td>
<td>
{{ asset.date_created|date:"Y-m-d H:i:s" }}
</td>
</tr>
<tr>
<td
class=
"text-navy"
>
备注
</td>
<td>
{{ asset.comment|default_if_none:"" }}
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<div
class=
"col-sm-5"
style=
"padding-left: 0;padding-right: 0"
>
</div>
<div
class=
"panel panel-primary"
>
</div>
<div
class=
"panel-heading"
>
<div
class=
"col-sm-4"
>
<i
class=
"fa fa-info-circle"
></i>
{% trans 'Quick modify' %}
<div
class=
"ibox float-e-margins"
>
</div>
<div
class=
"ibox-title"
>
<div
class=
"panel-body"
>
<h5>
拥有权限的用户
</h5>
<table
class=
"table"
>
<div
class=
"ibox-tools"
>
<tbody>
<a
class=
"collapse-link"
>
<tr
class=
"no-borders-tr"
>
<i
class=
"fa fa-chevron-up"
></i>
<td
width=
"50%"
>
{% trans 'Active' %}:
</td>
</a>
<td><span
class=
"pull-right"
>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<div
class=
"switch"
>
<i
class=
"fa fa-wrench"
></i>
<div
class=
"onoffswitch"
>
</a>
<input
type=
"checkbox"
{%
if
asset
.
is_active
%}
checked
{%
endif
%}
class=
"onoffswitch-checkbox"
id=
"is_active"
>
<ul
class=
"dropdown-menu dropdown-user"
>
<label
class=
"onoffswitch-label"
for=
"is_active"
>
</ul>
<span
class=
"onoffswitch-inner"
></span>
<a
class=
"close-link"
>
<span
class=
"onoffswitch-switch"
></span>
<i
class=
"fa fa-times"
></i>
</label>
</a>
</div>
</div>
</div>
</div>
</span></td>
<div
class=
"ibox-content ibox-heading"
>
</tr>
<h3>
主机所有授权的信息
</h3>
<tr>
<small><i
class=
"fa fa-map-marker"
></i>
包含了此主机所有授权的信息.
</small>
<td>
{% trans 'Enable OTP' %}:
</td>
</div>
<td><span
class=
"pull-right"
>
<div
class=
"ibox-content"
>
<div
class=
"switch"
>
<div>
<div
class=
"onoffswitch"
>
<div
class=
"text-left"
>
<input
type=
"checkbox"
class=
"onoffswitch-checkbox"
{%
if
asset
.
enable_otp
%}
checked
{%
endif
%}
{% if perm_info %}
id=
"enable_otp"
>
{% if user_perm %}
<label
class=
"onoffswitch-label"
for=
"enable_otp"
>
<table
class=
"table"
>
<span
class=
"onoffswitch-inner"
></span>
<p>
授权用户信息
</p>
<span
class=
"onoffswitch-switch"
></span>
<td
class=
"text-navy"
>
授权用户
</td>
</label>
<td
class=
"text-navy"
>
关联用户
</td>
</div>
{% for perm in user_perm %}
</div>
</span></td>
</tr>
<tr>
<td>
{% trans 'Reset password' %}:
</td>
<td>
<span
class=
"pull-right"
>
<button
type=
"button"
class=
"btn btn-primary btn-xs"
id=
"btn_reset_password"
style=
"width: 54px"
>
{% trans 'Reset' %}
</button>
</span>
</td>
</tr>
<tr>
<td>
{% trans 'Reset ssh key' %}:
</td>
<td>
<span
class=
"pull-right"
>
<button
type=
"button"
class=
"btn btn-primary btn-xs"
id=
"btn_reset_pk"
style=
"width: 54px;"
>
{% trans 'Reset' %}
</button>
</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div
class=
"panel panel-info"
>
<div
class=
"panel-heading"
>
<i
class=
"fa fa-info-circle"
></i>
{% trans 'Asset group' %}
</div>
<div
class=
"panel-body"
>
<table
class=
"table group_edit"
>
<tbody>
<form>
<tr>
<tr>
<td
class=
"text-navy"
><a
href=
"{% url 'user_detail' %}?id={{ perm.0.id }}"
>
{{ perm.0 }}
</a></td>
<td
colspan=
"2"
class=
"no-borders"
>
<td>
<select
data-placeholder=
"{% trans 'Join user groups' %}"
id=
"slct_groups"
class=
"select2"
style=
"width: 100%"
multiple=
""
tabindex=
"4"
>
<table
class=
"table"
>
{% for group in groups %}
{% if perm.1 %}
<option
value=
"{{ group.id }}"
id=
"opt_{{ group.id }}"
>
{{ group.name }}
</option>
{% for role in perm.1 %}
{% endfor %}
<tr>
</select>
<td
class=
"text-navy"
><a
href=
"{% url 'role_detail' %}?id={{ role.id }}"
>
{{ role }}
</a></td>
</tr>
{% endfor %}
{% endif %}
</table>
</td>
</td>
</tr>
</tr>
{% endfor %}
<tr>
</table>
<td
colspan=
"2"
class=
"no-borders"
>
{% endif %}
<button
type=
"button"
class=
"btn btn-info btn-small"
id=
"btn_add_user_group"
>
{% trans 'Join' %}
</button>
{% if user_group_perm %}
</td>
<table
class=
"table"
>
</tr>
<p>
授权用户组信息
</p>
</form>
<td
class=
"text-navy"
>
授权用户组
</td>
<td
class=
"text-navy"
>
组详情
</td>
{% for user_group in user_group_perm %}
<tr>
<td
class=
"text-navy"
>
{{ user_group }}
</td>
<td
class=
"text-navy"
><a
href=
"{% url 'user_group_list' %}?gid={{ user_group.id }}"
>
详情
</a></td>
</tr>
{% endfor %}
</table>
{% endif %}
{% if user_rule_perm %}
{% for group in asset.groups.all %}
<table
class=
"table"
>
<tr>
<p>
授权规则信息
</p>
<td
><b
class=
"bdg_user_group"
data-gid=
{{
group
.
id
}}
>
{{ group.name }}
</b></td>
<td
class=
"text-navy"
>
授权规则
</td>
<td>
<td
class=
"text-navy"
>
详情
</td>
<button
class=
"btn btn-danger pull-right btn-sm btn_delete_user_group"
type=
"button"
><i
class=
"fa fa-minus"
></i></button>
{% for rule in user_rule_perm %}
</td>
<tr>
</tr>
<td
class=
"text-navy"
>
{{ rule }}
</td>
{% endfor %}
<td
class=
"text-navy"
><a
href=
"{% url 'rule_detail' %}?id={{ rule.id }}"
>
详情
</a></td>
</tbody>
</tr>
</table>
{% endfor %}
</div>
</table>
{% endif %}
{% else %}
<p
class=
"text-center"
>
(暂无)
</p>
{% endif %}
</div>
</div>
</div>
</div>
</div>
</div>
<div
class=
"ibox-title"
>
<h5>
主机修改记录
</h5>
{#
<a
href=
"{% url 'asset_edit' %}?id={{ asset.id }}"
data-toggle=
"tooltip"
class=
"text-success pull-center"
data-placement=
"bottom"
title=
"修改"
>
&
nbsp
&
nbsp
&
nbsp
&
nbsp点击修改
</a>
#}
<div
class=
"ibox-tools"
>
<a
class=
"collapse-link"
>
<i
class=
"fa fa-chevron-up"
></i>
</a>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<ul
class=
"dropdown-menu dropdown-user"
>
</ul>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
<div
class=
"ibox-content ibox-heading"
>
<h3>
主机修改记录
</h3>
<small><i
class=
"fa fa-map-marker"
></i>
包含了此主机所有历史修改记录.
</small>
</div>
<div
class=
"ibox-content"
>
<div
class=
"feed-activity-list"
>
{% if asset_record %}
{# {% for r in asset_record %}#}
{#
<div
class=
"feed-element"
>
#}
{#
<div>
#}
{#
<small
class=
"pull-right"
>
{{ r.alert_time|naturaltime }}
</small>
#}
{#
<strong
class=
"text-navy"
>
{{ r.username }}
</strong>
#}
{# {% for i in r.content|str_to_list %}#}
{#
<div>
{{ i.0 }} 由
<span
class=
"text-success"
>
{{ i.1|str_to_code }}
</span>
改为
<span
class=
"text-warning"
>
{{ i.2|str_to_code }}
</span></div>
#}
{# {% endfor %}#}
{#
<small
class=
"text-success"
>
{{ r.alert_time }}
</small>
#}
{#
</div>
#}
{#
</div>
#}
{# {% endfor %}#}
{% else %}
<p
class=
"text-center"
>
(暂无)
</p>
{% endif %}
</div>
</div>
</div>
</div>
<div
class=
"col-sm-4"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
最近一周登录记录
</h5>
<div
class=
"ibox-tools"
>
<a
class=
"collapse-link"
>
<i
class=
"fa fa-chevron-up"
></i>
</a>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<ul
class=
"dropdown-menu dropdown-user"
>
</ul>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
<div
class=
"ibox-content ibox-heading"
>
<h3>
最近一周登录记录
</h3>
<small><i
class=
"fa fa-map-marker"
></i>
此主机最近一周用户登录信息.
</small>
</div>
<div
class=
"ibox-content inspinia-timeline"
>
{% if log %}
{% for l in log %}
<div
class=
"timeline-item"
>
<div
class=
"row"
>
<div
class=
"col-xs-5 date"
>
<i
class=
"fa fa-info-circle"
></i>
<small
class=
"text-navy"
>
{{ l.user }}
</small>
<br/>
</div>
<div
class=
"col-xs-7 content no-top-border"
>
<p
class=
"m-b-xs"
><strong>
详细信息
</strong></p>
<p>
来源IP: {{ l.remote_ip }}
</p>
<p>
开始: {{ l.start_time |date:"Y-m-d H:i:s" }}
</p>
<p>
结束: {{ l.end_time |date:"Y-m-d H:i:s" }}
</p>
</div>
</div>
</div>
{% endfor %}
<button
id=
"show"
class=
"btn btn-primary btn-block m-t"
><i
class=
"fa fa-arrow-down"
></i>
所有
</button>
<div
id=
'more'
style=
"display: none"
>
<br/>
{% for l in log_more %}
<div
class=
"timeline-item"
>
<div
class=
"row"
>
<div
class=
"col-xs-5 date"
>
<i
class=
"fa fa-info-circle"
></i>
<small
class=
"text-navy"
>
{{ l.user }}
</small>
<br/>
</div>
<div
class=
"col-xs-7 content no-top-border"
>
<p
class=
"m-b-xs"
><strong>
详细信息
</strong></p>
<p>
来源IP: {{ l.remote_ip }}
</p>
<p>
开始: {{ l.start_time |date:"Y-m-d H:i:s" }}
</p>
<p>
结束: {{ l.end_time |date:"Y-m-d H:i:s" }}
</p>
</div>
</div>
</div>
{% endfor %}
{% else %}
<p
class=
"text-center"
>
(暂无)
</p>
{% endif %}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block custom_foot_js %}
<script>
<script>
$
(
document
).
ready
(
function
(){
$
(
'#show'
).
click
(
function
(){
$
(
'#show'
).
css
(
'display'
,
'none'
);
$
(
'#more'
).
css
(
'display'
,
'block'
);
})
})
</script>
</script>
{% endblock %}
{% endblock %}
\ No newline at end of file
apps/assets/templates/assets/asset_list.html
View file @
b95c1dee
...
@@ -117,7 +117,7 @@
...
@@ -117,7 +117,7 @@
<td
class=
"text-center"
name=
"id"
value=
"{{ asset.id }}"
data-editable=
'false'
>
<td
class=
"text-center"
name=
"id"
value=
"{{ asset.id }}"
data-editable=
'false'
>
<input
name=
"id"
value=
"{{ asset.id }}"
type=
"checkbox"
class=
"i-checks"
>
<input
name=
"id"
value=
"{{ asset.id }}"
type=
"checkbox"
class=
"i-checks"
>
</td>
</td>
<td
class=
"text-center"
>
{{ asset.hostname }}
</td>
<td
class=
"text-center"
>
<a
href=
"{% url 'assets:asset-detail' pk=asset.id %}"
>
{{ asset.hostname }}
</a>
</td>
<td
class=
"text-center"
>
{{ asset.ip }}
</td>
<td
class=
"text-center"
>
{{ asset.ip }}
</td>
<td
class=
"text-center"
>
{{ asset.system_type }}
</td>
<td
class=
"text-center"
>
{{ asset.system_type }}
</td>
<td
class=
"text-center"
>
{{ asset.cpu }} | {{ asset.memory }} | {{ asset.disk }}
</td>
<td
class=
"text-center"
>
{{ asset.cpu }} | {{ asset.memory }} | {{ asset.disk }}
</td>
...
...
apps/assets/views.py
View file @
b95c1dee
...
@@ -10,22 +10,31 @@ from django.urls import reverse_lazy
...
@@ -10,22 +10,31 @@ from django.urls import reverse_lazy
from
django.contrib.messages.views
import
SuccessMessageMixin
from
django.contrib.messages.views
import
SuccessMessageMixin
from
django.views.generic.detail
import
DetailView
,
SingleObjectMixin
from
django.views.generic.detail
import
DetailView
,
SingleObjectMixin
from
.models
import
Asset
,
AssetGroup
,
IDC
,
AssetExtend
,
AdminUser
,
SystemUser
from
.models
import
Asset
,
AssetGroup
,
IDC
,
AssetExtend
,
AdminUser
,
SystemUser
,
Label
from
.forms
import
AssetForm
,
AssetGroupForm
,
IDCForm
,
AdminUserForm
,
SystemUserForm
from
.forms
import
AssetForm
,
AssetGroupForm
,
IDCForm
,
AdminUserForm
,
SystemUserForm
from
.hands
import
AdminUserRequiredMixin
from
.hands
import
AdminUserRequiredMixin
class
AssetCreateView
(
CreateView
):
class
AssetCreateView
(
AdminUserRequiredMixin
,
CreateView
):
model
=
Asset
model
=
Asset
form_class
=
AssetForm
form_class
=
AssetForm
template_name
=
'assets/asset_create.html'
template_name
=
'assets/asset_create.html'
success_url
=
reverse_lazy
(
'assets:asset-list'
)
success_url
=
reverse_lazy
(
'assets:asset-list'
)
def
form_
in
valid
(
self
,
form
):
def
form_valid
(
self
,
form
):
asset
=
form
.
save
(
commit
=
False
)
asset
=
form
.
save
(
commit
=
False
)
asset
.
is_active
=
1
key
=
self
.
request
.
POST
.
get
(
'key'
,
''
)
value
=
self
.
request
.
POST
.
get
(
'value'
,
''
)
asset
.
save
()
asset
.
save
()
return
super
(
AssetCreateView
,
self
)
.
form_invalid
(
form
)
Label
.
objects
.
create
(
key
=
key
,
value
=
value
,
asset
=
asset
)
return
super
(
AssetCreateView
,
self
)
.
form_valid
(
form
)
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
AssetCreateView
,
self
)
.
get_context_data
(
**
kwargs
)
context
.
update
({
'admin_users'
:
AdminUser
.
objects
.
all
()})
assert
isinstance
(
context
,
object
)
print
(
context
)
return
context
class
AssetUpdateView
(
UpdateView
):
class
AssetUpdateView
(
UpdateView
):
...
...
apps/static/css/style.css
View file @
b95c1dee
/*
@import url("https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700");
@import url("https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700");
@import url("https://fonts.googleapis.com/css?family=Roboto:400,300,500,700");
@import url("https://fonts.googleapis.com/css?family=Roboto:400,300,500,700");
*/
/*
/*
*
*
* INSPINIA - Responsive Admin Theme
* INSPINIA - Responsive Admin Theme
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment