djgentelella 0.5.6__py3-none-any.whl → 0.5.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- djgentelella/__init__.py +1 -1
- djgentelella/chunked_upload/constants.py +1 -1
- djgentelella/chunked_upload/utils.py +47 -0
- djgentelella/management/commands/delete_expired_uploads.py +42 -32
- djgentelella/migrations/0018_alter_chunkedupload_status.py +1 -1
- djgentelella/static/djgentelella.vendors.header.min.js +1 -1
- djgentelella/static/gentelella/js/permissionmanagement.js +174 -183
- djgentelella/static/vendors/friconix/friconix.js +1 -1
- djgentelella/tasks.py +39 -0
- djgentelella/templates/gentelella/permission_management/permissionmanagement_list.html +19 -10
- {djgentelella-0.5.6.dist-info → djgentelella-0.5.7.dist-info}/METADATA +63 -7
- {djgentelella-0.5.6.dist-info → djgentelella-0.5.7.dist-info}/RECORD +16 -14
- {djgentelella-0.5.6.dist-info → djgentelella-0.5.7.dist-info}/AUTHORS +0 -0
- {djgentelella-0.5.6.dist-info → djgentelella-0.5.7.dist-info}/LICENSE.txt +0 -0
- {djgentelella-0.5.6.dist-info → djgentelella-0.5.7.dist-info}/WHEEL +0 -0
- {djgentelella-0.5.6.dist-info → djgentelella-0.5.7.dist-info}/top_level.txt +0 -0
|
@@ -5,35 +5,35 @@ group_id = 0;
|
|
|
5
5
|
user_id = 0;
|
|
6
6
|
|
|
7
7
|
const Toast = Swal.mixin({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
toast: true,
|
|
9
|
+
position: 'top-end',
|
|
10
|
+
showConfirmButton: false,
|
|
11
|
+
timer: 3000,
|
|
12
|
+
timerProgressBar: true,
|
|
13
|
+
didOpen: (toast) => {
|
|
14
|
+
toast.addEventListener('mouseenter', Swal.stopTimer)
|
|
15
|
+
toast.addEventListener('mouseleave', Swal.resumeTimer)
|
|
16
|
+
}
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
$(document).ready(function(){
|
|
19
|
+
$(document).ready(function () {
|
|
20
20
|
|
|
21
21
|
let selectuser = $('#select_user');
|
|
22
22
|
let selectgroup = $('#select_group');
|
|
23
23
|
|
|
24
|
-
if(selectuser.length>0){
|
|
25
|
-
let selectusercontext={
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
if (selectuser.length > 0) {
|
|
25
|
+
let selectusercontext = {
|
|
26
|
+
ajax: {
|
|
27
|
+
url: permission_context.select_user_url,
|
|
28
|
+
dataType: 'json',
|
|
29
|
+
},
|
|
30
|
+
width: '100%'
|
|
31
31
|
};
|
|
32
32
|
extract_select2_context(selectusercontext, selectuser);
|
|
33
|
-
selectusercontext.placeholder=permission_context.user_placeholder;
|
|
33
|
+
selectusercontext.placeholder = permission_context.user_placeholder;
|
|
34
34
|
selectuser.select2(selectusercontext);
|
|
35
35
|
$("#group_container").hide();
|
|
36
|
-
$('#btn_user').click(function(){
|
|
36
|
+
$('#btn_user').click(function () {
|
|
37
37
|
selected_user_or_group = false;
|
|
38
38
|
$("#user_container").show();
|
|
39
39
|
$("#group_container").hide();
|
|
@@ -48,19 +48,19 @@ $(document).ready(function(){
|
|
|
48
48
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
if(selectgroup.length>0){
|
|
52
|
-
let selectgroupcontext={
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
if (selectgroup.length > 0) {
|
|
52
|
+
let selectgroupcontext = {
|
|
53
|
+
ajax: {
|
|
54
|
+
url: permission_context.select_group_url,
|
|
55
|
+
dataType: 'json',
|
|
56
|
+
},
|
|
57
|
+
width: '100%'
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
extract_select2_context(selectgroupcontext, selectgroup);
|
|
61
|
-
selectgroupcontext.placeholder=permission_context.group_placeholder;
|
|
61
|
+
selectgroupcontext.placeholder = permission_context.group_placeholder;
|
|
62
62
|
selectgroup.select2(selectgroupcontext);
|
|
63
|
-
$("#btn_group").click(function(){
|
|
63
|
+
$("#btn_group").click(function () {
|
|
64
64
|
$("#group_container").show();
|
|
65
65
|
selected_user_or_group = false;
|
|
66
66
|
$("#user_container").hide();
|
|
@@ -71,189 +71,180 @@ $(document).ready(function(){
|
|
|
71
71
|
$("#select_group").empty().trigger('change')
|
|
72
72
|
option = 2
|
|
73
73
|
});
|
|
74
|
-
if(selectuser.length==0){
|
|
74
|
+
if (selectuser.length == 0) {
|
|
75
75
|
option = 2;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
$(this).find('.btn').toggleClass('btn-primary');
|
|
80
|
+
$('.btn-bs-toggle').click(function () {
|
|
81
|
+
$(this).find('.btn').toggleClass('active');
|
|
82
|
+
if ($(this).find('.btn-primary').length > 0) {
|
|
83
|
+
$(this).find('.btn').toggleClass('btn-primary');
|
|
85
84
|
}
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
$(this).find('.btn').toggleClass('btn-default');
|
|
86
|
+
});
|
|
88
87
|
|
|
89
88
|
$('#select_user, #select_group').on('select2:select', function (evt) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
url = permission_context.get_permissions.replace("/0", "/"+evt.params.data.id);
|
|
97
|
-
urlname = encodeURIComponent($('#btn_perms').data("urlname"));
|
|
98
|
-
get_permissions_url = url+"?option="+option+"&urlname="+urlname;
|
|
99
|
-
$.ajax({
|
|
100
|
-
url: get_permissions_url,
|
|
101
|
-
method: 'GET',
|
|
102
|
-
dataType: "json",
|
|
103
|
-
success: function(data){
|
|
104
|
-
var checkboxes = $('input[type="checkbox"][name="permission"]');
|
|
105
|
-
if(data['result'].length>0){
|
|
106
|
-
checkboxchecked = checkboxes.filter(':checked');
|
|
107
|
-
checkboxchecked.iCheck('uncheck');
|
|
108
|
-
data['result'].forEach(function(i){
|
|
109
|
-
$('input[type="checkbox"][value="'+i.id+'"]').iCheck('check');
|
|
110
|
-
});
|
|
111
|
-
}else{
|
|
112
|
-
checkboxchecked = checkboxes.filter(':checked');
|
|
113
|
-
checkboxchecked.iCheck('uncheck');
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
error: function(xhr, ajaxOptions, thrownError){
|
|
117
|
-
if(xhr.status==404) {
|
|
118
|
-
object = (option == 2)?permission_context.group_label:permission_context.user_label;
|
|
119
|
-
message = permission_context.not_found_object+ " " + object.lower()
|
|
120
|
-
}
|
|
89
|
+
selected_user_or_group = true;
|
|
90
|
+
if (option == 1) {
|
|
91
|
+
user_id = evt.params.data.id;
|
|
92
|
+
} else {
|
|
93
|
+
group_id = evt.params.data.id;
|
|
121
94
|
}
|
|
122
|
-
|
|
95
|
+
url = permission_context.get_permissions.replace("/0", "/" + evt.params.data.id);
|
|
96
|
+
urlname = encodeURIComponent($('#btn_perms').data("urlname"));
|
|
97
|
+
get_permissions_url = url + "?option=" + option + "&urlname=" + urlname;
|
|
98
|
+
$.ajax({
|
|
99
|
+
url: get_permissions_url,
|
|
100
|
+
method: 'GET',
|
|
101
|
+
dataType: "json",
|
|
102
|
+
success: function (data) {
|
|
103
|
+
var checkboxes = $('input[type="checkbox"][name="permission"]');
|
|
104
|
+
if (data['result'].length > 0) {
|
|
105
|
+
checkboxchecked = checkboxes.filter(':checked');
|
|
106
|
+
checkboxchecked.iCheck('uncheck');
|
|
107
|
+
data['result'].forEach(function (i) {
|
|
108
|
+
$('input[type="checkbox"][value="' + i.id + '"]').iCheck('check');
|
|
109
|
+
});
|
|
110
|
+
} else {
|
|
111
|
+
checkboxchecked = checkboxes.filter(':checked');
|
|
112
|
+
checkboxchecked.iCheck('uncheck');
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
error: function (xhr, ajaxOptions, thrownError) {
|
|
116
|
+
if (xhr.status == 404) {
|
|
117
|
+
object = (option == 2) ? permission_context.group_label : permission_context.user_label;
|
|
118
|
+
message = permission_context.not_found_object + " " + object.lower()
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
123
122
|
});
|
|
124
123
|
|
|
125
|
-
function update_categorieicon_collapsed(){
|
|
124
|
+
function update_categorieicon_collapsed() {
|
|
125
|
+
$('a.categories').each(function () {
|
|
126
|
+
const $btn = $(this);
|
|
127
|
+
const target = $btn.attr('data-bs-target'); // Bootstrap 5
|
|
128
|
+
const $icon = $btn.find('i').first();
|
|
129
|
+
const $collapse = $(target);
|
|
126
130
|
|
|
127
|
-
|
|
131
|
+
if (!$collapse.length || !$icon.length) return;
|
|
128
132
|
|
|
129
|
-
|
|
133
|
+
// open collapse
|
|
134
|
+
$collapse.on('shown.bs.collapse', function () {
|
|
135
|
+
$icon.removeClass('fa-plus').addClass('fa-minus');
|
|
136
|
+
});
|
|
130
137
|
|
|
131
|
-
|
|
138
|
+
// close collapse
|
|
139
|
+
$collapse.on('hidden.bs.collapse', function () {
|
|
140
|
+
$icon.removeClass('fa-minus').addClass('fa-plus');
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
}
|
|
132
144
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
145
|
+
$('#permission_modal').on('show.bs.modal', function (e) {
|
|
146
|
+
var urltarget = $(e.relatedTarget).data('parameter');
|
|
136
147
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
148
|
+
$.ajax({
|
|
149
|
+
url: urltarget,
|
|
150
|
+
method: 'GET',
|
|
151
|
+
dataType: "json",
|
|
152
|
+
success: function (data) {
|
|
153
|
+
result = data['result'];
|
|
154
|
+
if (result == "") {
|
|
155
|
+
result = permission_context.not_found_permissions_label;
|
|
141
156
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
157
|
+
$('#permissionbody').html(result);
|
|
158
|
+
$('input[type="checkbox"][name="permission"]').iCheck({
|
|
159
|
+
checkboxClass: 'icheckbox_flat-green',
|
|
160
|
+
radioClass: 'iradio_flat-green',
|
|
161
|
+
increaseArea: '20%' // optional
|
|
162
|
+
});
|
|
163
|
+
update_categorieicon_collapsed();
|
|
164
|
+
},
|
|
165
|
+
error: function (xhr, ajaxOptions, thrownError) {
|
|
166
|
+
if (xhr.status == 404) {
|
|
167
|
+
$('#permissionbody').html(permission_context.not_found_permissions_label);
|
|
146
168
|
}
|
|
147
169
|
}
|
|
148
|
-
|
|
149
170
|
});
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
$('#permission_modal').on('show.bs.modal', function (e) {
|
|
155
|
-
var urltarget = $(e.relatedTarget).data('parameter');
|
|
156
|
-
|
|
157
|
-
$.ajax({
|
|
158
|
-
url: urltarget,
|
|
159
|
-
method: 'GET',
|
|
160
|
-
dataType: "json",
|
|
161
|
-
success: function(data){
|
|
162
|
-
result = data['result'];
|
|
163
|
-
if (result == "" ){
|
|
164
|
-
result = permission_context.not_found_permissions_label;
|
|
165
|
-
}
|
|
166
|
-
$('#permissionbody').html(result);
|
|
167
|
-
$('input[type="checkbox"][name="permission"]').iCheck({
|
|
168
|
-
checkboxClass: 'icheckbox_flat-green',
|
|
169
|
-
radioClass: 'iradio_flat-green',
|
|
170
|
-
increaseArea: '20%' // optional
|
|
171
|
-
});
|
|
172
|
-
update_categorieicon_collapsed();
|
|
173
|
-
},
|
|
174
|
-
error: function(xhr, ajaxOptions, thrownError){
|
|
175
|
-
if(xhr.status==404) {
|
|
176
|
-
$('#permissionbody').html(permission_context.not_found_permissions_label);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
171
|
|
|
181
172
|
});
|
|
182
173
|
|
|
183
|
-
$("#btn_savepermissions").click(function(){
|
|
184
|
-
|
|
185
|
-
if($('#btn_perms').data("urlname")!=""){
|
|
186
|
-
if(selected_user_or_group){
|
|
187
|
-
permsurl_save = permission_context.save_permissions
|
|
188
|
-
selected = []
|
|
189
|
-
inputs_selected = $('input[type="checkbox"][name="permission"]').filter(":checked");
|
|
190
|
-
for(i=0; i < inputs_selected.length; i++){
|
|
191
|
-
selected.push($(inputs_selected[i]).val());
|
|
192
|
-
}
|
|
193
|
-
data_save = {
|
|
194
|
-
"option": option,
|
|
195
|
-
"permissions": selected,
|
|
196
|
-
"urlname": $('#btn_perms').data("urlname"),
|
|
197
|
-
};
|
|
198
|
-
if(option == 2){
|
|
199
|
-
data_save['group'] = group_id;
|
|
200
|
-
}else{
|
|
201
|
-
data_save['user'] = user_id;
|
|
202
|
-
}
|
|
174
|
+
$("#btn_savepermissions").click(function () {
|
|
203
175
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
176
|
+
if ($('#btn_perms').data("urlname") != "") {
|
|
177
|
+
if (selected_user_or_group) {
|
|
178
|
+
permsurl_save = permission_context.save_permissions
|
|
179
|
+
selected = []
|
|
180
|
+
inputs_selected = $('input[type="checkbox"][name="permission"]').filter(":checked");
|
|
181
|
+
for (i = 0; i < inputs_selected.length; i++) {
|
|
182
|
+
selected.push($(inputs_selected[i]).val());
|
|
183
|
+
}
|
|
184
|
+
data_save = {
|
|
185
|
+
"option": option,
|
|
186
|
+
"permissions": selected,
|
|
187
|
+
"urlname": $('#btn_perms').data("urlname"),
|
|
188
|
+
};
|
|
189
|
+
if (option == 2) {
|
|
190
|
+
data_save['group'] = group_id;
|
|
191
|
+
} else {
|
|
192
|
+
data_save['user'] = user_id;
|
|
193
|
+
}
|
|
212
194
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
195
|
+
$.ajax({
|
|
196
|
+
url: permsurl_save,
|
|
197
|
+
method: "POST",
|
|
198
|
+
dataType: "json",
|
|
199
|
+
data: data_save,
|
|
200
|
+
traditional: true,
|
|
201
|
+
headers: {'X-CSRFToken': getCookie('csrftoken')},
|
|
202
|
+
success: function (data) {
|
|
203
|
+
|
|
204
|
+
if (data.result == 'error') {
|
|
205
|
+
Toast.fire({
|
|
206
|
+
icon: 'error',
|
|
207
|
+
title: permission_context.validation_error
|
|
208
|
+
});
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
var checkboxes = $('input[type="checkbox"][name="permission"]');
|
|
212
|
+
checkboxchecked = checkboxes.filter(':checked');
|
|
213
|
+
checkboxchecked.iCheck('uncheck');
|
|
214
|
+
$("#select_user").empty().trigger('change')
|
|
215
|
+
$("#select_group").empty().trigger('change')
|
|
216
|
+
Toast.fire({
|
|
217
|
+
icon: 'success',
|
|
218
|
+
title: permission_context.save_messages
|
|
219
|
+
});
|
|
220
|
+
selected_user_or_group = false;
|
|
221
|
+
$('#permission_modal').modal('hide');
|
|
222
|
+
},
|
|
223
|
+
error: function (xhr, ajaxOptions, thrownError) {
|
|
224
|
+
message = permission_context.error
|
|
225
|
+
if (xhr.status == 404) {
|
|
226
|
+
object = (option == 2) ? permission_context.group_label : permission_context.user_label;
|
|
227
|
+
message = permission_context.not_found_object + " " + object.lower()
|
|
228
|
+
}
|
|
229
|
+
Toast.fire({
|
|
230
|
+
icon: 'error',
|
|
231
|
+
title: message,
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
} else {
|
|
236
|
+
|
|
237
|
+
Toast.fire({
|
|
238
|
+
icon: 'error',
|
|
239
|
+
title: permission_context.not_select_valid_option
|
|
240
|
+
});
|
|
237
241
|
}
|
|
242
|
+
} else {
|
|
238
243
|
Toast.fire({
|
|
239
244
|
icon: 'error',
|
|
240
|
-
title:
|
|
245
|
+
title: permission_context.not_found_permissions_label
|
|
241
246
|
});
|
|
242
|
-
|
|
243
|
-
});
|
|
244
|
-
}else{
|
|
245
|
-
|
|
246
|
-
Toast.fire({
|
|
247
|
-
icon: 'error',
|
|
248
|
-
title: permission_context.not_select_valid_option
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
}else{
|
|
252
|
-
Toast.fire({
|
|
253
|
-
icon: 'error',
|
|
254
|
-
title: permission_context.not_found_permissions_label
|
|
255
|
-
});
|
|
256
|
-
}
|
|
247
|
+
}
|
|
257
248
|
});
|
|
258
249
|
|
|
259
|
-
});
|
|
250
|
+
});
|