mirror of https://github.com/jumpserver/jumpserver
prepare change api name
parent
aa08f0aa48
commit
a5e487441f
|
@ -9,66 +9,66 @@ app_name = 'assets'
|
|||
urlpatterns = [
|
||||
# Resource asset url
|
||||
url(r'^$', views.AssetListView.as_view(), name='asset-index'),
|
||||
url(r'^asset$', views.AssetListView.as_view(), name='asset-list'),
|
||||
url(r'^asset/create$', views.AssetCreateView.as_view(), name='asset-create'),
|
||||
url(r'^asset/(?P<pk>[0-9]+)$', views.AssetDetailView.as_view(), name='asset-detail'),
|
||||
url(r'^asset/(?P<pk>[0-9]+)/update', views.AssetUpdateView.as_view(), name='asset-update'),
|
||||
url(r'^asset/(?P<pk>[0-9]+)/delete$', views.AssetDeleteView.as_view(), name='asset-delete'),
|
||||
url(r'^asset/$', views.AssetListView.as_view(), name='asset-list'),
|
||||
url(r'^asset/create/$', views.AssetCreateView.as_view(), name='asset-create'),
|
||||
url(r'^asset/(?P<pk>[0-9]+)/$', views.AssetDetailView.as_view(), name='asset-detail'),
|
||||
url(r'^asset/(?P<pk>[0-9]+)/update/$', views.AssetUpdateView.as_view(), name='asset-update'),
|
||||
url(r'^asset/(?P<pk>[0-9]+)/delete/$', views.AssetDeleteView.as_view(), name='asset-delete'),
|
||||
url(r'^asset-modal$', views.AssetModalListView.as_view(), name='asset-modal-list'),
|
||||
url(r'^asset-modal-update$', views.AssetModalCreateView.as_view(), name='asset-modal-update'),
|
||||
|
||||
# Resource asset group url
|
||||
url(r'^asset-group$', views.AssetGroupListView.as_view(), name='asset-group-list'),
|
||||
url(r'^asset-group/create$', views.AssetGroupCreateView.as_view(), name='asset-group-create'),
|
||||
url(r'^asset-group/(?P<pk>[0-9]+)$', views.AssetGroupDetailView.as_view(), name='asset-group-detail'),
|
||||
url(r'^asset-group/(?P<pk>[0-9]+)/update$', views.AssetGroupUpdateView.as_view(), name='asset-group-update'),
|
||||
url(r'^asset-group/(?P<pk>[0-9]+)/delete$', views.AssetGroupDeleteView.as_view(), name='asset-group-delete'),
|
||||
url(r'^asset-group/$', views.AssetGroupListView.as_view(), name='asset-group-list'),
|
||||
url(r'^asset-group/create/$', views.AssetGroupCreateView.as_view(), name='asset-group-create'),
|
||||
url(r'^asset-group/(?P<pk>[0-9]+)/$', views.AssetGroupDetailView.as_view(), name='asset-group-detail'),
|
||||
url(r'^asset-group/(?P<pk>[0-9]+)/update/$', views.AssetGroupUpdateView.as_view(), name='asset-group-update'),
|
||||
url(r'^asset-group/(?P<pk>[0-9]+)/delete/$', views.AssetGroupDeleteView.as_view(), name='asset-group-delete'),
|
||||
|
||||
url(r'^tags$', views.TagsListView.as_view(), name='asset-tag-list'),
|
||||
url(r'^asset-by-tag/(?P<tag_id>[0-9]+)$', views.TagView.as_view(), name='asset-tags'),
|
||||
url(r'^tags/create$', views.AssetTagCreateView.as_view(), name='asset-tag-create'),
|
||||
url(r'^asset-tag/(?P<pk>[0-9]+)$', views.AssetTagDetailView.as_view(), name='asset-tag-detail'),
|
||||
url(r'^asset-tag/(?P<pk>[0-9]+)/update$', views.AssetTagUpdateView.as_view(), name='asset-tag-update'),
|
||||
url(r'^asset-tag/(?P<pk>[0-9]+)/delete$', views.AssetTagDeleteView.as_view(), name='asset-tag-delete'),
|
||||
url(r'^tags/$', views.TagsListView.as_view(), name='asset-tag-list'),
|
||||
url(r'^asset-by-tag/(?P<tag_id>[0-9]+)/$', views.TagView.as_view(), name='asset-tags'),
|
||||
url(r'^tags/create/$', views.AssetTagCreateView.as_view(), name='asset-tag-create'),
|
||||
url(r'^asset-tag/(?P<pk>[0-9]+)/$', views.AssetTagDetailView.as_view(), name='asset-tag-detail'),
|
||||
url(r'^asset-tag/(?P<pk>[0-9]+)/update/$', views.AssetTagUpdateView.as_view(), name='asset-tag-update'),
|
||||
url(r'^asset-tag/(?P<pk>[0-9]+)/delete/$', views.AssetTagDeleteView.as_view(), name='asset-tag-delete'),
|
||||
|
||||
# Resource idc url
|
||||
url(r'^idc$', views.IDCListView.as_view(), name='idc-list'),
|
||||
url(r'^idc/create$', views.IDCCreateView.as_view(), name='idc-create'),
|
||||
url(r'^idc/(?P<pk>[0-9]+)$', views.IDCDetailView.as_view(), name='idc-detail'),
|
||||
url(r'^idc/(?P<pk>[0-9]+)/update', views.IDCUpdateView.as_view(), name='idc-update'),
|
||||
url(r'^idc/(?P<pk>[0-9]+)/delete$', views.IDCDeleteView.as_view(), name='idc-delete'),
|
||||
url(r'^idc/(?P<pk>[0-9]+)/assets$', views.IDCAssetsView.as_view(), name='idc-assets'),
|
||||
url(r'^idc/$', views.IDCListView.as_view(), name='idc-list'),
|
||||
url(r'^idc/create/$', views.IDCCreateView.as_view(), name='idc-create'),
|
||||
url(r'^idc/(?P<pk>[0-9]+)/$', views.IDCDetailView.as_view(), name='idc-detail'),
|
||||
url(r'^idc/(?P<pk>[0-9]+)/update/', views.IDCUpdateView.as_view(), name='idc-update'),
|
||||
url(r'^idc/(?P<pk>[0-9]+)/delete/$', views.IDCDeleteView.as_view(), name='idc-delete'),
|
||||
url(r'^idc/(?P<pk>[0-9]+)/assets/$', views.IDCAssetsView.as_view(), name='idc-assets'),
|
||||
|
||||
# Resource admin user url
|
||||
url(r'^admin-user$', views.AdminUserListView.as_view(), name='admin-user-list'),
|
||||
url(r'^admin-user/create$', views.AdminUserCreateView.as_view(), name='admin-user-create'),
|
||||
url(r'^admin-user/(?P<pk>[0-9]+)$', views.AdminUserDetailView.as_view(), name='admin-user-detail'),
|
||||
url(r'^admin-user/(?P<pk>[0-9]+)/update', views.AdminUserUpdateView.as_view(), name='admin-user-update'),
|
||||
url(r'^admin-user/(?P<pk>[0-9]+)/delete$', views.AdminUserDeleteView.as_view(), name='admin-user-delete'),
|
||||
url(r'^admin-user/$', views.AdminUserListView.as_view(), name='admin-user-list'),
|
||||
url(r'^admin-user/create/$', views.AdminUserCreateView.as_view(), name='admin-user-create'),
|
||||
url(r'^admin-user/(?P<pk>[0-9]+)/$', views.AdminUserDetailView.as_view(), name='admin-user-detail'),
|
||||
url(r'^admin-user/(?P<pk>[0-9]+)/update/$', views.AdminUserUpdateView.as_view(), name='admin-user-update'),
|
||||
url(r'^admin-user/(?P<pk>[0-9]+)/delete/$', views.AdminUserDeleteView.as_view(), name='admin-user-delete'),
|
||||
|
||||
# Resource system user url
|
||||
url(r'^system-user$', views.SystemUserListView.as_view(), name='system-user-list'),
|
||||
url(r'^system-user/create$', views.SystemUserCreateView.as_view(), name='system-user-create'),
|
||||
url(r'^system-user/(?P<pk>[0-9]+)$', views.SystemUserDetailView.as_view(), name='system-user-detail'),
|
||||
url(r'^system-user/(?P<pk>[0-9]+)/update', views.SystemUserUpdateView.as_view(), name='system-user-update'),
|
||||
url(r'^system-user/(?P<pk>[0-9]+)/delete$', views.SystemUserDeleteView.as_view(), name='system-user-delete'),
|
||||
url(r'^system-user/(?P<pk>[0-9]+)/asset$', views.SystemUserAssetView.as_view(), name='system-user-asset'),
|
||||
url(r'^system-user/$', views.SystemUserListView.as_view(), name='system-user-list'),
|
||||
url(r'^system-user/create/$', views.SystemUserCreateView.as_view(), name='system-user-create'),
|
||||
url(r'^system-user/(?P<pk>[0-9]+)/$', views.SystemUserDetailView.as_view(), name='system-user-detail'),
|
||||
url(r'^system-user/(?P<pk>[0-9]+)/update/$', views.SystemUserUpdateView.as_view(), name='system-user-update'),
|
||||
url(r'^system-user/(?P<pk>[0-9]+)/delete/$', views.SystemUserDeleteView.as_view(), name='system-user-delete'),
|
||||
url(r'^system-user/(?P<pk>[0-9]+)/asset/$', views.SystemUserAssetView.as_view(), name='system-user-asset'),
|
||||
# url(r'^system-user/(?P<pk>[0-9]+)/asset-group$', views.SystemUserAssetGroupView.as_view(),
|
||||
# name='system-user-asset-group'),
|
||||
|
||||
]
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
router.register(r'v1/asset-groups', api.AssetGroupViewSet, 'api-asset-group')
|
||||
router.register(r'v1/assets', api.AssetViewSet, 'api-asset')
|
||||
router.register(r'v1/idc', api.IDCViewSet, 'api-idc')
|
||||
router.register(r'v1/admin-user', api.AdminUserViewSet, 'api-admin-user')
|
||||
router.register(r'v1/system-user', api.SystemUserViewSet, 'api-system-user')
|
||||
router.register(r'v1/asset-groups', api.AssetGroupViewSet, 'asset-group')
|
||||
router.register(r'v1/assets', api.AssetViewSet, 'asset')
|
||||
router.register(r'v1/idc', api.IDCViewSet, 'idc')
|
||||
router.register(r'v1/admin-user', api.AdminUserViewSet, 'admin-user')
|
||||
router.register(r'v1/system-user', api.SystemUserViewSet, 'system-user')
|
||||
|
||||
urlpatterns += [
|
||||
url(r'^v1/assets_bulk/$', api.AssetListUpdateApi.as_view(), name='api-asset-bulk-update'),
|
||||
url(r'^v1/assets_bulk/$', api.AssetListUpdateApi.as_view(), name='asset-bulk-update'),
|
||||
# url(r'^v1/idc/(?P<pk>[0-9]+)/assets/$', api.IDCAssetsApi.as_view(), name='api-idc-assets'),
|
||||
url(r'^v1/system-user/auth/', api.SystemUserAuthApi.as_view(), name='api-system-user-auth'),
|
||||
url(r'^v1/system-user/auth/', api.SystemUserAuthApi.as_view(), name='system-user-auth'),
|
||||
]
|
||||
|
||||
urlpatterns += router.urls
|
||||
|
|
|
@ -16,7 +16,7 @@ urlpatterns = [
|
|||
]
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
router.register(r'v1/proxy-log', api.ProxyLogViewSet, 'api-proxy-log')
|
||||
router.register(r'v1/command-log', api.CommandLogViewSet, 'api-command-log')
|
||||
router.register(r'v1/proxy-log', api.ProxyLogViewSet, 'proxy-log')
|
||||
router.register(r'v1/command-log', api.CommandLogViewSet, 'command-log')
|
||||
|
||||
urlpatterns += router.urls
|
||||
|
|
|
@ -22,11 +22,16 @@ from django.views.generic.base import TemplateView
|
|||
urlpatterns = [
|
||||
url(r'^captcha/', include('captcha.urls')),
|
||||
url(r'^$', TemplateView.as_view(template_name='base.html'), name='index'),
|
||||
url(r'^(api/)?users/', include('users.urls')),
|
||||
url(r'^(api/)?assets/', include('assets.urls')),
|
||||
url(r'^(api/)?perms/', include('perms.urls')),
|
||||
url(r'^(api/)?audits/', include('audits.urls')),
|
||||
url(r'^(api/)?terminal/', include('terminal.urls')),
|
||||
url(r'^users/', include('users.urls', namespace='users')),
|
||||
url(r'^assets/', include('assets.urls', namespace='assets')),
|
||||
url(r'^perms/', include('perms.urls', namespace='perms')),
|
||||
url(r'^audits/', include('audits.urls', namespace='audits')),
|
||||
url(r'^terminal/', include('terminal.urls', namespace='terminal')),
|
||||
url(r'^api/users/', include('users.urls', namespace='api-users')),
|
||||
url(r'^api/assets/', include('assets.urls', namespace='api-assets')),
|
||||
url(r'^api/perms/', include('perms.urls', namespace='api-perms')),
|
||||
url(r'^api/audits/', include('audits.urls', namespace='api-audits')),
|
||||
url(r'^api/terminal/', include('terminal.urls', namespace='api-terminal')),
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class AssetPermissionViewSet(viewsets.ModelViewSet):
|
|||
def get_queryset(self):
|
||||
queryset = super(AssetPermissionViewSet, self).get_queryset()
|
||||
user_id = self.request.query_params.get('user', '')
|
||||
user_group_id = self.request.query_params.get('user-group', '')
|
||||
user_group_id = self.request.query_params.get('user_group', '')
|
||||
|
||||
if user_id and user_id.isdigit():
|
||||
user = get_object_or_404(User, id=int(user_id))
|
||||
|
@ -165,7 +165,7 @@ class UserGroupGrantedAssetsApi(ListAPIView):
|
|||
user_group_id = self.kwargs.get('pk', '')
|
||||
|
||||
if user_group_id:
|
||||
user_group = get_object_or_404(User, id=user_group_id)
|
||||
user_group = get_object_or_404(UserGroup, id=user_group_id)
|
||||
queryset = get_user_group_granted_assets(user_group)
|
||||
else:
|
||||
queryset = []
|
||||
|
@ -180,7 +180,7 @@ class UserGroupGrantedAssetGroupsApi(ListAPIView):
|
|||
user_group_id = self.kwargs.get('pk', '')
|
||||
|
||||
if user_group_id:
|
||||
user_group = get_object_or_404(User, id=user_group_id)
|
||||
user_group = get_object_or_404(UserGroup, id=user_group_id)
|
||||
queryset = get_user_group_granted_asset_groups(user_group)
|
||||
else:
|
||||
queryset = []
|
||||
|
|
|
@ -23,21 +23,21 @@ urlpatterns = [
|
|||
]
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
router.register('v1/asset-permissions', api.AssetPermissionViewSet, 'api-asset-permission')
|
||||
router.register('v1/asset-permissions', api.AssetPermissionViewSet, 'asset-permission')
|
||||
|
||||
urlpatterns += [
|
||||
url(r'^v1/user/my/assets/$', api.MyGrantedAssetsApi.as_view(), name='api-my-assets'),
|
||||
url(r'^v1/user/my/asset-groups/$', api.MyGrantedAssetsGroupsApi.as_view(), name='api-my-asset-groups'),
|
||||
url(r'^v1/user/my/assets/$', api.MyGrantedAssetsApi.as_view(), name='my-assets'),
|
||||
url(r'^v1/user/my/asset-groups/$', api.MyGrantedAssetsGroupsApi.as_view(), name='my-asset-groups'),
|
||||
url(r'^v1/user/my/asset-group/(?P<pk>[0-9]+)/assets/$', api.MyAssetGroupAssetsApi.as_view(),
|
||||
name='user-my-asset-group-assets'),
|
||||
|
||||
# Select user permission of asset and asset group
|
||||
url(r'^v1/user/(?P<pk>[0-9]+)/assets/$', api.UserGrantedAssetsApi.as_view(), name='api-user-assets'),
|
||||
url(r'^v1/user/(?P<pk>[0-9]+)/assets/$', api.UserGrantedAssetsApi.as_view(), name='user-assets'),
|
||||
url(r'^v1/user/(?P<pk>[0-9]+)/asset-groups/$', api.UserGrantedAssetGroupsApi.as_view(),
|
||||
name='api-user-asset-groups'),
|
||||
|
||||
# Select user group permission of asset and asset group
|
||||
url(r'^v1/user-group/(?P<pk>[0-9]+)/assets/$', api.UserGroupGrantedAssetsApi.as_view(), name='api-user-group-assets'),
|
||||
url(r'^v1/user-group/(?P<pk>[0-9]+)/assets/$', api.UserGroupGrantedAssetsApi.as_view(), name='user-group-assets'),
|
||||
url(r'^v1/user-group/(?P<pk>[0-9]+)/asset-groups/$', api.UserGroupGrantedAssetGroupsApi.as_view(),
|
||||
name='api-user-group-asset-groups'),
|
||||
|
||||
|
|
|
@ -265,6 +265,7 @@ $.fn.serializeObject = function()
|
|||
};
|
||||
var jumpserver = {};
|
||||
jumpserver.checked = false;
|
||||
jumpserver.selected = {};
|
||||
jumpserver.initDataTable = function (options) {
|
||||
// options = {
|
||||
// ele *: $('#dataTable_id'),
|
||||
|
@ -283,10 +284,9 @@ jumpserver.initDataTable = function (options) {
|
|||
{
|
||||
targets: 0,
|
||||
orderable: false,
|
||||
createdCell: function(td) {
|
||||
$(td).html('<input type="checkbox" class="ipt_check">');
|
||||
}
|
||||
},
|
||||
createdCell: function(td, cellData) {
|
||||
$(td).html('<input type="checkbox" class="text-center ipt_check" id=99991937>'.replace('99991937', cellData));
|
||||
}},
|
||||
{className: 'text-center', targets: '_all'}
|
||||
];
|
||||
columnDefs = options.columnDefs ? options.columnDefs.concat(columnDefs) : columnDefs;
|
||||
|
@ -298,31 +298,7 @@ jumpserver.initDataTable = function (options) {
|
|||
},
|
||||
order: options.order || [[ 1, 'asc' ]],
|
||||
select: options.select || 'multi',
|
||||
buttons: options.buttons || [
|
||||
{extend: 'excel',
|
||||
exportOptions: {
|
||||
modifier: {
|
||||
selected: true
|
||||
}
|
||||
}
|
||||
},
|
||||
{extend: 'pdf',
|
||||
exportOptions: {
|
||||
modifier: {
|
||||
selected: true
|
||||
}
|
||||
}
|
||||
},
|
||||
{extend: 'print',
|
||||
customize: function (win){
|
||||
$(win.document.body).addClass('white-bg');
|
||||
$(win.document.body).css('font-size', '10px');
|
||||
$(win.document.body).find('table')
|
||||
.addClass('compact')
|
||||
.css('font-size', 'inherit');
|
||||
}
|
||||
}
|
||||
],
|
||||
buttons: [],
|
||||
columnDefs: columnDefs,
|
||||
ajax: {
|
||||
url: options.ajax_url ,
|
||||
|
@ -334,9 +310,11 @@ jumpserver.initDataTable = function (options) {
|
|||
table.on('select', function(e, dt, type, indexes) {
|
||||
var $node = table[ type ]( indexes ).nodes().to$();
|
||||
$node.find('input.ipt_check').prop('checked', true);
|
||||
jumpserver.selected[$node.find('input.ipt_check').prop('id')] = true
|
||||
}).on('deselect', function(e, dt, type, indexes) {
|
||||
var $node = table[ type ]( indexes ).nodes().to$();
|
||||
$node.find('input.ipt_check').prop('checked', false);
|
||||
jumpserver.selected[$node.find('input.ipt_check').prop('id')] = false
|
||||
}).on('draw', function(){
|
||||
$('#op').html(options.op_html || '');
|
||||
$('#uc').html(options.uc_html || '');
|
||||
|
|
|
@ -154,7 +154,7 @@
|
|||
$(td).html(btn)
|
||||
}}
|
||||
],
|
||||
ajax_url: '{% url "perms:api-asset-permission-list" %}?user-group={{ user_group.id }}',
|
||||
ajax_url: '{% url "perms:api-asset-permission-list" %}?user_group={{ user_group.id }}',
|
||||
columns: [{data: function(){return ""}}, {data: "name" }, {data: "assets" }, {data: "asset_groups"},
|
||||
{data: "system_users"}, {data: "is_active"}, {data: "id"}]
|
||||
};
|
||||
|
@ -165,7 +165,6 @@
|
|||
id: $this.attr('id'),
|
||||
user_group_id: {{ user_group.id }}
|
||||
};
|
||||
console.log(body);
|
||||
var the_url = "{% url 'perms:revoke-user-group-asset-permission' %}";
|
||||
var success = function () {
|
||||
$this.closest('tr').remove();
|
||||
|
@ -177,6 +176,8 @@
|
|||
success_message: '{% trans "Revoke Successfully!" %}',
|
||||
success: success
|
||||
});
|
||||
}).on('click', 'buttons-excel', function () {
|
||||
console.log('click excel')
|
||||
})
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -133,7 +133,7 @@
|
|||
}
|
||||
}}
|
||||
],
|
||||
ajax_url: '{% url "perms:api-user-assets" pk=user.id %}',
|
||||
ajax_url: '{% url "perms:api-user-group-assets" pk=user_group.id %}',
|
||||
columns: [{data: function(){return ""}}, {data: "hostname" }, {data: "ip" }, {data: "port"},
|
||||
{data: "system_users_join"}, {data: "is_active"}]
|
||||
};
|
||||
|
@ -148,8 +148,8 @@
|
|||
$(td).html(detail_btn.replace('99991937', rowData.id));
|
||||
}}
|
||||
],
|
||||
ajax_url: '{% url "perms:api-user-asset-groups" pk=user.id %}',
|
||||
columns: [{data: function(){return ""}}, {data: "name" }, {data: "asset_amount" }]
|
||||
ajax_url: '{% url "perms:api-user-group-asset-groups" pk=user_group.id %}',
|
||||
columns: [{data: function(){return ""}}, {data: "name" }, {data: "assets_amount" }]
|
||||
};
|
||||
jumpserver.initDataTable(options);
|
||||
jumpserver.initDataTable(options2);
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
{% extends '_base_list.html' %}
|
||||
{% load i18n static %}
|
||||
{% block table_search %}{% endblock %}
|
||||
{% block table_search %}
|
||||
<div class="html5buttons">
|
||||
<div class="dt-buttons btn-group">
|
||||
<a class="btn btn-default buttons-pdf" tabindex="0" href="#">
|
||||
<span>PDF</span></a>
|
||||
<a class="btn btn-default buttons-excel" tabindex="0" href="#">
|
||||
<span>Excel</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block table_container %}
|
||||
<div class="uc pull-left m-l-5 m-r-5"><a href="{% url "users:user-create" %}" class="btn btn-sm btn-primary"> {% trans "Create user" %} </a></div>
|
||||
<div class="uc pull-left"><a href="javascript:void(0);" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#user_import_modal"> {% trans "Import user" %} </a></div>
|
||||
|
@ -72,11 +82,19 @@ $(document).ready(function(){
|
|||
}
|
||||
}}],
|
||||
ajax_url: '{% url "users:api-user-list" %}',
|
||||
columns: [{data: function(){return ""}}, {data: "username" }, {data: "name" }, {data: "get_role_display" },
|
||||
{data: "groups_display" }, {data: "is_valid" }, {data: "id" }],
|
||||
op_html: $('#actions').html()
|
||||
columns: [{data: "id"}, {data: "username" }, {data: "name" }, {data: "get_role_display" },
|
||||
{data: "groups_display" }, {data: "is_valid" }, {data: "id" }]
|
||||
};
|
||||
jumpserver.initDataTable(options);
|
||||
var table = jumpserver.initDataTable(options);
|
||||
|
||||
$('.buttons-pdf').click(function () {
|
||||
var users = [];
|
||||
var rows = table.rows('.selected').data();
|
||||
$.each(rows, function (index, obj) {
|
||||
users.push(obj.id)
|
||||
})
|
||||
});
|
||||
|
||||
}).on('click', '#btn_bulk_update', function(){
|
||||
var action = $('#slct_bulk_update').val();
|
||||
var $data_table = $('#user_list_table').DataTable();
|
||||
|
@ -216,15 +234,11 @@ $(document).ready(function(){
|
|||
} else {
|
||||
$('#user_import_modal').modal('hide');
|
||||
var $data_table = $('#user_list_table').DataTable();
|
||||
toastr.success("{% trans 'Import User Success.' %}")
|
||||
toastr.success("{% trans 'Import User Success.' %}");
|
||||
$data_table.ajax.reload();
|
||||
}
|
||||
}
|
||||
$form.ajaxSubmit({success: success});
|
||||
}).on('change', '#id_excel', function() {
|
||||
$(this).siblings('.help-block').remove();
|
||||
}).on('click', '.ipt_check', function () {
|
||||
console.log('Hello')
|
||||
})
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
|
@ -2,13 +2,14 @@
|
|||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import csv
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
from django.contrib.auth import login as auth_login, logout as auth_logout
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.contrib.messages.views import SuccessMessageMixin
|
||||
from django.core.files.storage import default_storage
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.http import HttpResponseRedirect, HttpResponse
|
||||
from django.shortcuts import reverse, redirect
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.utils.translation import ugettext as _
|
||||
|
@ -530,3 +531,14 @@ class BulkImportUserView(AdminUserRequiredMixin, JSONResponseMixin, FormView):
|
|||
'msg': 'ok' if not errors else '<br />'.join(errors)
|
||||
}
|
||||
return self.render_json_response(data)
|
||||
|
||||
|
||||
def down_csv(request, xx):
|
||||
print(xx)
|
||||
response = HttpResponse(content_type='application/csv')
|
||||
response['Content-Disposition'] = 'attachment; filename="somefile.csv"'
|
||||
writer = csv.writer(response)
|
||||
writer.writerow(['First row', 'Foo', 'Bar', 'Baz'])
|
||||
writer.writerow(['Second row', 'A', 'B', 'C', '"Testing"', "Here's a quote"])
|
||||
return response
|
||||
|
||||
|
|
Loading…
Reference in New Issue