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
ce9ff67b
Commit
ce9ff67b
authored
Jan 17, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 读取不到prefix
parent
01895baf
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
8 deletions
+4
-8
api.py
apps/assets/api.py
+2
-2
serializers.py
apps/assets/serializers.py
+1
-1
asset_group_list.html
apps/assets/templates/assets/asset_group_list.html
+0
-4
settings.py
apps/jumpserver/settings.py
+1
-1
No files found.
apps/assets/api.py
View file @
ce9ff67b
...
...
@@ -18,7 +18,7 @@ from rest_framework.response import Response
from
rest_framework_bulk
import
BulkModelViewSet
from
rest_framework_bulk
import
ListBulkCreateUpdateDestroyAPIView
from
django.shortcuts
import
get_object_or_404
from
django.db.models
import
Q
from
django.db.models
import
Q
,
Count
from
rest_framework.pagination
import
LimitOffsetPagination
from
common.mixins
import
CustomFilterMixin
...
...
@@ -87,7 +87,7 @@ class AssetGroupViewSet(CustomFilterMixin, BulkModelViewSet):
"""
Asset group api set, for add,delete,update,list,retrieve resource
"""
queryset
=
AssetGroup
.
objects
.
all
()
queryset
=
AssetGroup
.
objects
.
all
()
.
annotate
(
asset_count
=
Count
(
"assets"
))
serializer_class
=
serializers
.
AssetGroupSerializer
permission_classes
=
(
IsSuperUser
,)
...
...
apps/assets/serializers.py
View file @
ce9ff67b
...
...
@@ -22,7 +22,7 @@ class AssetGroupSerializer(BulkSerializerMixin, serializers.ModelSerializer):
@staticmethod
def
get_assets_amount
(
obj
):
return
obj
.
asset
s
.
count
()
return
obj
.
asset
_count
class
AssetUpdateSystemUserSerializer
(
serializers
.
ModelSerializer
):
...
...
apps/assets/templates/assets/asset_group_list.html
View file @
ce9ff67b
...
...
@@ -34,10 +34,6 @@ $(document).ready(function(){
var
detail_btn
=
'<a href="{% url "assets:asset-group-detail" pk=DEFAULT_PK %}">'
+
cellData
+
'</a>'
;
$
(
td
).
html
(
detail_btn
.
replace
(
'{{ DEFAULT_PK }}'
,
rowData
.
id
));
}},
{
targets
:
3
,
createdCell
:
function
(
td
,
cellData
)
{
var
innerHtml
=
cellData
.
length
>
30
?
cellData
.
substring
(
0
,
30
)
+
'...'
:
cellData
;
$
(
td
).
html
(
'<a href="javascript:void(0);" data-toggle="tooltip" title="'
+
cellData
+
'">'
+
innerHtml
+
'</a>'
);
}},
{
targets
:
4
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
var
update_btn
=
'<a href="{% url "assets:asset-group-update" pk=DEFAULT_PK %}" class="btn btn-xs m-l-xs btn-info">{% trans "Update" %}</a>'
.
replace
(
'{{ DEFAULT_PK }}'
,
cellData
);
var
del_btn
=
'<a class="btn btn-xs btn-danger m-l-xs btn_asset_group_delete" data-uid="{{ DEFAULT_PK }}">{% trans "Delete" %}</a>'
.
replace
(
'{{ DEFAULT_PK }}'
,
cellData
);
...
...
apps/jumpserver/settings.py
View file @
ce9ff67b
...
...
@@ -274,7 +274,7 @@ EMAIL_HOST_USER = CONFIG.EMAIL_HOST_USER
EMAIL_HOST_PASSWORD
=
CONFIG
.
EMAIL_HOST_PASSWORD
EMAIL_USE_SSL
=
CONFIG
.
EMAIL_USE_SSL
EMAIL_USE_TLS
=
CONFIG
.
EMAIL_USE_TLS
EMAIL_SUBJECT_PREFIX
=
CONFIG
.
EMAIL_SUBJECT_PREFIX
EMAIL_SUBJECT_PREFIX
=
CONFIG
.
EMAIL_SUBJECT_PREFIX
or
''
REST_FRAMEWORK
=
{
# Use Django's standard `django.contrib.auth` permissions,
...
...
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