I want to set django for loop to set value through javascript like this. is this correct way? or Is there any other way?
var table = $('.checkbox-datatable').DataTable({
'scrollCollapse': true,
'autoWidth': false,
'responsive': true,
"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"language": {
"info": "_START_-_END of TOTAL_ entries",
searchPlaceholder: "Search",
paginate: {
next: '<i class="ion-chevron-right"></i>',
previous: '<i class="ion-chevron-left"></i>'
}
},
'columnDefs': [{
'targets': 0,
'searchable': false,
'orderable': false,
'className': 'dt-body-center',
'render': function (data, type, full, meta){
return '<div class="dt-checkbox"><input type="checkbox" name=
"id[]" id="chkuser" value="' + {% for dd in departmentData %}{{dd.id}}{% endfor %} + '" /><span class="dt-checkbox-label"></span></div>';
}
}],
'order': [[1, 'asc']]
});