djgentelella 0.3.25__py3-none-any.whl → 0.3.27__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.
@@ -700,113 +700,116 @@ $.fn.select2related = function(action, relatedobjs=[]) {
700
700
  })(jQuery)
701
701
 
702
702
  function convertFileToBase64(file) {
703
- return new Promise((resolve, reject) => {
704
- const reader = new FileReader();
703
+ return new Promise((resolve, reject) => {
704
+ const reader = new FileReader();
705
705
 
706
- reader.onload = () => {
707
- const base64String = reader.result.split(',')[1];
708
- resolve(base64String);
709
- };
706
+ reader.onload = () => {
707
+ const base64String = reader.result.split(',')[1];
708
+ resolve(base64String);
709
+ };
710
710
 
711
- reader.onerror = (error) => {
712
- reject(error);
713
- };
711
+ reader.onerror = (error) => {
712
+ reject(error);
713
+ };
714
714
 
715
- reader.readAsDataURL(file);
716
- });
715
+ reader.readAsDataURL(file);
716
+ });
717
717
  }
718
718
 
719
- async function obtainFormAsJSON(form, prefix = '', extras={}) {
720
- const fields = form.elements;
721
- const formData = {};
722
- // typeof variable === 'function'
723
- for( let key in extras){
724
- if(typeof extras[key] === 'function'){
725
- formData[key]=extras[key](form, key, prefix);
726
- }else{
727
- formData[key]=extras[key];
719
+ async function obtainFormAsJSON(form, prefix = '', extras = {}, format = true) {
720
+ const fields = form.elements;
721
+ const formData = {};
722
+ // typeof variable === 'function'
723
+ for (let key in extras) {
724
+ if (typeof extras[key] === 'function') {
725
+ formData[key] = extras[key](form, key, prefix);
726
+ } else {
727
+ formData[key] = extras[key];
728
+ }
728
729
  }
729
- }
730
730
 
731
- for (let i = 0; i < fields.length; i++) {
732
- const field = fields[i];
733
-
734
- if (field.type !== 'submit' && field.type !== 'button') {
735
- const fieldName = field.name.replace(prefix, '');
736
- if(field.type === 'textarea'){
737
- formData[fieldName] = $(field).val();
738
- }else if(field.type === 'checkbox'){
739
- formData[fieldName] = field.checked;
740
- }else if (field.type === 'radio') {
741
- if(field.checked){
742
- formData[fieldName] = $(field).val();
743
- }
744
- }else if (field.type === 'file') {
745
- const files = Array.from(field.files);
746
- const filesBase64 = [];
747
-
748
- for (let j = 0; j < files.length; j++) {
749
- const file = files[j];
750
- try {
751
- const base64String = await convertFileToBase64(file);
752
- filesBase64.push({ name: file.name, value: base64String });
753
- } catch (error) {
754
- console.error('Error converting file:', error);
755
- }
731
+ for (let i = 0; i < fields.length; i++) {
732
+ const field = fields[i];
733
+
734
+ if (field.type !== 'submit' && field.type !== 'button') {
735
+ const fieldName = field.name.replace(prefix, '');
736
+ if (field.type === 'textarea') {
737
+ formData[fieldName] = $(field).val();
738
+ } else if (field.type === 'checkbox') {
739
+ formData[fieldName] = field.checked;
740
+ } else if (field.type === 'radio') {
741
+ if (field.checked) {
742
+ formData[fieldName] = $(field).val();
743
+ }
744
+ } else if (field.type === 'file') {
745
+ const files = Array.from(field.files);
746
+ const filesBase64 = [];
747
+
748
+ for (let j = 0; j < files.length; j++) {
749
+ const file = files[j];
750
+ try {
751
+ const base64String = await convertFileToBase64(file);
752
+ filesBase64.push({name: file.name, value: base64String});
753
+ } catch (error) {
754
+ console.error('Error converting file:', error);
755
+ }
756
+ }
757
+
758
+ formData[fieldName] = filesBase64;
759
+ } else if (field.multiple) {
760
+ const selectedOptions = Array.from(field.selectedOptions);
761
+ const selectedValues = selectedOptions.map((option) => option.value);
762
+ formData[fieldName] = selectedValues;
763
+ } else {
764
+ formData[fieldName] = field.value;
765
+ }
756
766
  }
767
+ }
757
768
 
758
- formData[fieldName] = filesBase64;
759
- } else if (field.multiple) {
760
- const selectedOptions = Array.from(field.selectedOptions);
761
- const selectedValues = selectedOptions.map((option) => option.value);
762
- formData[fieldName] = selectedValues;
763
- } else {
764
- formData[fieldName] = field.value;
765
- }
769
+ if (format) {
770
+ return JSON.stringify(formData);
766
771
  }
767
- }
768
772
 
769
- return JSON.stringify(formData);
773
+ return formData;
770
774
  }
771
775
 
772
- function convertToStringJson(form, prefix="", extras={}){
773
- result=obtainFormAsJSON(form[0], prefix=prefix, extras=extras);
774
- return result;
776
+ function convertToStringJson(form, prefix = "", extras = {}, format = true) {
777
+ return obtainFormAsJSON(form[0], prefix, extras, format);
775
778
  }
776
779
 
777
- function load_errors(error_list, obj, parentdiv){
780
+ function load_errors(error_list, obj, parentdiv) {
778
781
  ul_obj = "<ul class='errorlist form_errors d-flex justify-content-center'>";
779
- error_list.forEach((item)=>{
780
- ul_obj += "<li>"+item+"</li>";
782
+ error_list.forEach((item) => {
783
+ ul_obj += "<li>" + item + "</li>";
781
784
  });
782
785
  ul_obj += "</ul>"
783
786
  $(obj).parents(parentdiv).prepend(ul_obj);
784
787
  return ul_obj;
785
788
  }
786
789
 
787
- function form_field_errors(target_form, form_errors, prefix, parentdiv){
790
+ function form_field_errors(target_form, form_errors, prefix, parentdiv) {
788
791
  var item = "";
789
792
  for (const [key, value] of Object.entries(form_errors)) {
790
- item = " #id_" +prefix+key;
791
- if(target_form.find(item).length > 0){
793
+ item = " #id_" + prefix + key;
794
+ if (target_form.find(item).length > 0) {
792
795
  load_errors(form_errors[key], item, parentdiv);
793
796
  }
794
797
  }
795
798
  }
796
799
 
797
- function response_manage_type_data(instance, err_json_fn, error_text_fn){
798
- return function(response) {
800
+ function response_manage_type_data(instance, err_json_fn, error_text_fn) {
801
+ return function (response) {
799
802
  const contentType = response.headers.get("content-type");
800
- if(response.ok){
801
- if (contentType && contentType.indexOf("application/json") !== -1) {
803
+ if (response.ok) {
804
+ if (contentType && contentType.indexOf("application/json") !== -1) {
802
805
  return response.json();
803
- }else{
806
+ } else {
804
807
  return response.text();
805
808
  }
806
- }else{
809
+ } else {
807
810
  if (contentType && contentType.indexOf("application/json") !== -1) {
808
811
  response.json().then(data => err_json_fn(instance, data));
809
- }else{
812
+ } else {
810
813
  response.text().then(data => error_text_fn(instance, data));
811
814
  }
812
815
  return Promise.resolve(false);
@@ -816,20 +819,20 @@ function response_manage_type_data(instance, err_json_fn, error_text_fn){
816
819
  }
817
820
  }
818
821
 
819
- function clear_action_form(form){
822
+ function clear_action_form(form) {
820
823
  // clear switchery before the form reset so the check status doesn't get changed before the validation
821
- $(form).find("input[data-switchery=true]").each(function() {
822
- if($(this).prop("checked")){ // only reset it if it is checked
824
+ $(form).find("input[data-switchery=true]").each(function () {
825
+ if ($(this).prop("checked")) { // only reset it if it is checked
823
826
  $(this).trigger("click").prop("checked", false);
824
827
  }
825
828
  });
826
- $(form).find('[data-widget="TaggingInput"],[data-widget="EmailTaggingInput"]').each(function(i, e) {
827
- var tg=$(e).data().tagify;
828
- tg.removeAllTags();
829
+ $(form).find('[data-widget="TaggingInput"],[data-widget="EmailTaggingInput"]').each(function (i, e) {
830
+ var tg = $(e).data().tagify;
831
+ tg.removeAllTags();
829
832
  });
830
- $(form).find('[data-widget="FileChunkedUpload"],[data-widget="FileInput"]').each(function(i, e) {
831
- var tg=$(e).data().fileUploadWidget;
832
- tg.resetEmpty();
833
+ $(form).find('[data-widget="FileChunkedUpload"],[data-widget="FileInput"]').each(function (i, e) {
834
+ var tg = $(e).data().fileUploadWidget;
835
+ tg.resetEmpty();
833
836
  });
834
837
  $(form).trigger('reset');
835
838
  $(form).find("select option:selected").prop("selected", false);
@@ -842,25 +845,137 @@ var gt_form_modals = {}
842
845
  var gt_detail_modals = {}
843
846
  var gt_crud_objs = {};
844
847
 
848
+ function updateInstanceValuesForm(form, name, value) {
849
+ var item = form.find(
850
+ 'input[name="' + name + '"], ' +
851
+ 'textarea[name="' + name + '"], ' +
852
+ 'select[name="' + name + '"]'
853
+ );
854
+ item.each(function (i, inputfield) {
855
+ let done = false;
856
+ inputfield = $(inputfield);
857
+
858
+ if (inputfield.attr('class') === "chunkedvalue") {
859
+ if (value) {
860
+ var chunked = form.find('input[name="' + name + '_widget"]').data('fileUploadWidget');
861
+ chunked.addRemote(value);
862
+ }
863
+ done = true;
864
+ } else if (inputfield.attr('type') === 'file') {
865
+ if (value) {
866
+ var newlink = document.createElement('a');
867
+ newlink.href = value.url;
868
+ newlink.textContent = value.name;
869
+ newlink.target = "_blank";
870
+ newlink.classList.add("link-primary");
871
+ newlink.classList.add("file-link");
872
+ newlink.classList.add("d-block");
873
+ inputfield.before(newlink)
874
+ }
875
+ done = true;
876
+ } else if (inputfield.attr('type') === "checkbox") {
877
+ if (inputfield.data().widget === "YesNoInput") {
878
+ inputfield.prop("checked", !value);
879
+ inputfield.trigger("click");
880
+ done = true;
881
+ } else {
882
+ inputfield.prop("checked", value);
883
+ }
884
+ done = true;
885
+ } else if (inputfield.attr('type') === "radio") {
886
+ var is_icheck = inputfield.closest('.gtradio').length > 0;
887
+ var sel = inputfield.filter(function () {
888
+ return this.value === value.toString()
889
+ });
890
+ if (sel.length > 0) {
891
+ sel.prop("checked", true);
892
+ if (is_icheck) {
893
+ sel.iCheck('update');
894
+ sel.iCheck('check');
895
+ }
845
896
 
846
- function gtforms(index,manager, formList, extra=true) {
897
+ } else {
898
+ inputfield.prop("checked", false);
899
+ if (is_icheck) {
900
+ inputfield.iCheck('update');
901
+ inputfield.iCheck('uncheck');
902
+ }
903
+ }
904
+ done = true;
905
+ }
906
+ if (inputfield.data().widget === "EditorTinymce" || inputfield.data().widget === "TextareaWysiwyg") {
907
+ tinymce.get(inputfield.attr('id')).setContent(value);
908
+ done = true;
909
+ }
910
+ if (inputfield.data().widget === "TaggingInput" || inputfield.data().widget === "EmailTaggingInput") {
911
+ var tagifyelement = inputfield.data().tagify;
912
+ tagifyelement.removeAllTags();
913
+ tagifyelement.loadOriginalValues(value);
914
+ done = true;
915
+ }
916
+
917
+ // New code for testing (*** start ***)
918
+ // data loading in select, autocompleteselect, autocompletemultiselect
919
+ else if (inputfield.is('select') && inputfield.data().widget === "Select") {
920
+ inputfield.val(value).trigger('change');
921
+ done = true;
922
+ } else if (inputfield.is('select') && inputfield.data().widget === "AutocompleteSelect") {
923
+ let data = value;
924
+ let select2Obj = inputfield.data('select2');
925
+ if (select2Obj) {
926
+ inputfield.select2('trigger', 'select', {
927
+ data: data
928
+ });
929
+ }
930
+ done = true;
931
+ } else if (inputfield.is('select') && inputfield.data().widget === "AutocompleteSelectMultiple") {
932
+
933
+ if (Array.isArray(value)) {
934
+ value.forEach(item => {
935
+ let newOption = new Option(item.text, item.id, true, true);
936
+ inputfield.append(newOption);
937
+ });
938
+ inputfield.trigger('change');
939
+ }
940
+ done = true;
941
+ }
942
+ // New code for testing (*** end ***)
943
+
944
+ if (!done) {
945
+ inputfield.val(value);
946
+ }
947
+ });
948
+ }
949
+
950
+ function updateInstanceForm(form, data) {
951
+ for (let key in data) {
952
+ if (data.hasOwnProperty(key)) {
953
+ updateInstanceValuesForm(form, key, data[key])
954
+ }
955
+ }
956
+ }
957
+
958
+
959
+ function gtforms(index, manager, formList, extra = true) {
847
960
  return {
848
961
  index: index,
849
962
  order: index,
963
+ deleted: false,
850
964
  manager: manager,
851
965
  formList: formList,
852
966
  extra: extra,
853
967
  instance: null,
854
- deleteForm: function(){
855
- if( !this.manager.validateDeleteForm()) {
856
- this.manager.notify('error', 'You can not delete this form, minimum form validation failed' )
857
- return;
858
- }
968
+ deleteForm: function () {
969
+ if (!this.manager.validateDeleteForm()) {
970
+ this.manager.notify('error', 'You can not delete this form, minimum form validation failed')
971
+ return;
972
+ }
973
+ this.deleted = true;
859
974
  this.instance.hide();
860
- this.instance.find('input[name="'+this.manager.prefix+'-'+this.index+'-DELETE"]').prop( "checked", true );
975
+ this.instance.find('input[name="' + this.manager.prefix + '-' + this.index + '-DELETE"]').prop("checked", true);
861
976
  this.manager.deleteForm(this.order);
862
977
  },
863
- render: function(){
978
+ render: function () {
864
979
  var html = this.manager.template.replace(/__prefix__/gi, this.index);
865
980
  this.instance = $(html);
866
981
  formList.append(this.instance);
@@ -868,37 +983,42 @@ function gtforms(index,manager, formList, extra=true) {
868
983
  this.registerBtns();
869
984
 
870
985
  },
871
- reorder: function(oper){
872
- var brother = this.manager.getForm(this.order+oper);
873
- this.manager.switchFrom(this.order, this.order+oper);
874
- if(brother != null){
875
- if(oper == 1 ){
986
+ reorder: function (oper) {
987
+ var brother = this.manager.getForm(this.order + oper);
988
+ this.manager.switchFrom(this.order, this.order + oper);
989
+ if (brother != null) {
990
+ if (oper == 1) {
876
991
  this.instance.before(brother.instance);
877
- }else{
992
+ } else {
878
993
  brother.instance.before(this.instance);
879
994
  }
880
995
  }
881
996
  },
882
- registerBtns: function(){
997
+ registerBtns: function () {
883
998
  this.instance.find('.deletebtn').on('click', this.callDelete(this));
884
999
  // down increment order and up decrement order when forms are inserted in bottom
885
1000
  this.instance.find('.btndown').on('click', this.callReorder(this, 1));
886
1001
  this.instance.find('.btnup').on('click', this.callReorder(this, -1));
887
1002
  },
888
- callDelete: function(instance){
889
- return () => { instance.deleteForm() };
1003
+ callDelete: function (instance) {
1004
+ return () => {
1005
+ instance.deleteForm()
1006
+ };
890
1007
  },
891
- initializeWidgets: function(instance){
1008
+ initializeWidgets: function (instance) {
892
1009
  gt_find_initialize(instance);
893
1010
  },
894
- callReorder: function(instance, oper){
895
- return () => { instance.reorder(oper) }
1011
+ callReorder: function (instance, oper) {
1012
+ return () => {
1013
+ instance.reorder(oper)
1014
+ }
896
1015
  },
897
- updateOrder: function(){
898
- this.instance.find('input[name="'+this.manager.prefix+'-'+this.index+'-ORDER"]').val(this.order);
1016
+ updateOrder: function () {
1017
+ this.instance.find('input[name="' + this.manager.prefix + '-' + this.index + '-ORDER"]').val(this.order);
899
1018
  }
900
1019
  }
901
1020
  }
1021
+
902
1022
  function gtformSetManager(instance) {
903
1023
  var obj = {
904
1024
  index: 0,
@@ -915,49 +1035,61 @@ function gtformSetManager(instance) {
915
1035
  formList: instance.find('.formlist'),
916
1036
  template: '',
917
1037
  prefix: 'form-',
918
- initialize: function(){
919
- this.template = this.formsetControl.find(".formsettemplate").contents()[0].data;
920
- this.prefix = this.formsetControl.data('prefix');
921
- this.validateMax = this.formsetControl.data('validate-max') == '1';
922
- this.validateMin = this.formsetControl.data('validate-min') == '1';
923
- this.loadManagementForm();
924
- this.instance.find('.formsetadd').on('click', this.addBtnForm(this));
925
- this.addFormDom();
1038
+ initialize: function () {
1039
+ this.template = this.formsetControl.find(".formsettemplate").contents()[0].data;
1040
+ this.prefix = this.formsetControl.data('prefix');
1041
+ this.validateMax = this.formsetControl.data('validate-max') == '1';
1042
+ this.validateMin = this.formsetControl.data('validate-min') == '1';
1043
+ this.loadManagementForm();
1044
+ this.instance.find('.formsetadd').on('click', this.addBtnForm(this));
1045
+ this.addFormDom();
926
1046
  },
927
- addBtnForm: function(instance){
928
- return () => { instance.addEmtpyForm() };
1047
+ addBtnForm: function (instance) {
1048
+ return (e) => {
1049
+ instance.addEmtpyForm(e)
1050
+ };
929
1051
  },
930
- addEmtpyForm: function(){
931
- if(this.validateAddForm()){
1052
+ addEmtpyForm: function (e) {
1053
+ if (this.validateAddForm()) {
1054
+ this.activeForms += 1;
932
1055
  var form = gtforms(this.index, this, this.formList);
933
1056
  form.render();
934
1057
  this.forms.push(form);
1058
+ this.addForm(this, form, true, e);
935
1059
  this.index += 1;
936
1060
  this.updateTotalForms(+1);
937
- }else{
1061
+ } else {
938
1062
  this.notify('error', 'You cannot add new form, limit is exceded')
939
1063
  }
940
1064
  },
941
- addForm: function(object){},
942
- addFormDom: function(){
943
- this.formList.children().each((i, element) =>{
944
- var form = gtforms(this.index, this, this.formList, extra=false);
945
- form.instance = $(element);
946
- form.registerBtns();
947
- this.forms.push(form);
948
- this.index += 1;
1065
+ addForm: function (parent, object, isempty, event) {
1066
+ },
1067
+ addFormDom: function () {
1068
+ this.formList.children().each((i, element) => {
1069
+ this.activeForms += 1;
1070
+ var form = gtforms(this.index, this, this.formList, extra = false);
1071
+ form.instance = $(element);
1072
+ form.registerBtns();
1073
+ this.forms.push(form);
1074
+ this.addForm(this, form, false, null);
1075
+ this.index += 1;
949
1076
  });
950
1077
  },
951
- deleteForm: function(index){
952
- if( !this.validateDeleteForm()) return;
953
- if(index>=0 && index < this.forms.length){
954
- if(this.forms[index].extra){
1078
+ delForm: function (parent, index, form) {
1079
+ },
1080
+ deleteForm: function (index) {
1081
+ if (!this.validateDeleteForm()) return;
1082
+ this.activeForms = Math.max(0, this.activeForms - 1);
1083
+
1084
+ if (index >= 0 && index < this.forms.length) {
1085
+ this.delForm(this, index, this.forms[index]);
1086
+ if (this.forms[index].extra) {
955
1087
  this.forms.splice(index, 1);
956
1088
  this.updateTotalForms(-1);
957
- if(index == this.forms.length){
1089
+ if (index == this.forms.length) {
958
1090
  this.index -= 1;
959
- }else{
960
- for(var x=0; x<this.forms.length; x++){
1091
+ } else {
1092
+ for (var x = 0; x < this.forms.length; x++) {
961
1093
  this.forms[x].order = x;
962
1094
  this.forms[x].updateOrder();
963
1095
  }
@@ -966,40 +1098,40 @@ function gtformSetManager(instance) {
966
1098
 
967
1099
  }
968
1100
  },
969
- validateAddForm: function(){
970
- if(!this.validateMax) return true;
1101
+ validateAddForm: function () {
1102
+ if (!this.validateMax) return true;
971
1103
  return this.MAX_NUM_FORMS == -1 || this.TOTAL_FORMS < this.MAX_NUM_FORMS;
972
1104
  },
973
- validateDeleteForm: function(){
974
- if(!this.validateMin) return true;
1105
+ validateDeleteForm: function () {
1106
+ if (!this.validateMin) return true;
975
1107
  return this.MIN_NUM_FORMS == -1 || this.TOTAL_FORMS > this.MIN_NUM_FORMS;
976
1108
  },
977
- loadManagementForm: function(){
978
- this.TOTAL_FORMS = parseInt(this.formsetControl.find('input[name="'+this.prefix+'-TOTAL_FORMS"]').val());
979
- this.INITIAL_FORMS = parseInt(this.formsetControl.find('input[name="'+this.prefix+'-INITIAL_FORMS"]').val());
980
- this.MIN_NUM_FORMS = parseInt(this.formsetControl.find('input[name="'+this.prefix+'-MIN_NUM_FORMS"]').val());
981
- this.MAX_NUM_FORMS = parseInt(this.formsetControl.find('input[name="'+this.prefix+'-MAX_NUM_FORMS"]').val());
1109
+ loadManagementForm: function () {
1110
+ this.TOTAL_FORMS = parseInt(this.formsetControl.find('input[name="' + this.prefix + '-TOTAL_FORMS"]').val());
1111
+ this.INITIAL_FORMS = parseInt(this.formsetControl.find('input[name="' + this.prefix + '-INITIAL_FORMS"]').val());
1112
+ this.MIN_NUM_FORMS = parseInt(this.formsetControl.find('input[name="' + this.prefix + '-MIN_NUM_FORMS"]').val());
1113
+ this.MAX_NUM_FORMS = parseInt(this.formsetControl.find('input[name="' + this.prefix + '-MAX_NUM_FORMS"]').val());
982
1114
  },
983
- updateManagementForm: function(){
984
- this.formsetControl.find('input[name="'+this.prefix+'-TOTAL_FORMS"]').val(this.TOTAL_FORMS);
985
- this.formsetControl.find('input[name="'+this.prefix+'-INITIAL_FORMS"]').val(this.INITIAL_FORMS);
986
- this.formsetControl.find('input[name="'+this.prefix+'-MIN_NUM_FORMS"]').val(this.MIN_NUM_FORMS);
987
- this.formsetControl.find('input[name="'+this.prefix+'-MAX_NUM_FORMS"]').val(this.MAX_NUM_FORMS);
1115
+ updateManagementForm: function () {
1116
+ this.formsetControl.find('input[name="' + this.prefix + '-TOTAL_FORMS"]').val(this.TOTAL_FORMS);
1117
+ this.formsetControl.find('input[name="' + this.prefix + '-INITIAL_FORMS"]').val(this.INITIAL_FORMS);
1118
+ this.formsetControl.find('input[name="' + this.prefix + '-MIN_NUM_FORMS"]').val(this.MIN_NUM_FORMS);
1119
+ this.formsetControl.find('input[name="' + this.prefix + '-MAX_NUM_FORMS"]').val(this.MAX_NUM_FORMS);
988
1120
  },
989
- updateTotalForms: function(oper){
990
- this.TOTAL_FORMS = this.TOTAL_FORMS+oper;
991
- this.formsetControl.find('input[name="'+this.prefix+'-TOTAL_FORMS"]').val(this.TOTAL_FORMS);
1121
+ updateTotalForms: function (oper) {
1122
+ this.TOTAL_FORMS = this.TOTAL_FORMS + oper;
1123
+ this.formsetControl.find('input[name="' + this.prefix + '-TOTAL_FORMS"]').val(this.TOTAL_FORMS);
992
1124
  },
993
- getForm: function(index){
994
- if(index>=0 && index < this.forms.length){
1125
+ getForm: function (index) {
1126
+ if (index >= 0 && index < this.forms.length) {
995
1127
  return this.forms[index];
996
1128
  }
997
1129
  return null;
998
1130
  },
999
- switchFrom: function(fref, fswap){
1131
+ switchFrom: function (fref, fswap) {
1000
1132
  var freform = this.getForm(fref);
1001
1133
  var fswapform = this.getForm(fswap);
1002
- if(freform != null && fswapform != null){
1134
+ if (freform != null && fswapform != null) {
1003
1135
  var tmporder = freform.order;
1004
1136
  freform.order = fswapform.order;
1005
1137
  fswapform.order = tmporder;
@@ -1011,23 +1143,23 @@ function gtformSetManager(instance) {
1011
1143
  }
1012
1144
 
1013
1145
  },
1014
- redrawOrdering: function(){
1015
- for(var x=0; x<this.forms.length; x++){
1016
- this.formList.append(this.forms[x].instance);
1146
+ redrawOrdering: function () {
1147
+ for (var x = 0; x < this.forms.length; x++) {
1148
+ this.formList.append(this.forms[x].instance);
1017
1149
  }
1018
1150
  },
1019
- notify: function(type, text){
1151
+ notify: function (type, text) {
1020
1152
  console.log(text);
1021
1153
  },
1022
- clean: function(){
1023
- while(this.forms.length>0){
1154
+ clean: function () {
1155
+ while (this.forms.length > 0) {
1024
1156
  var f = this.forms.pop();
1025
1157
  f.instance.remove();
1026
1158
  }
1027
- this.TOTAL_FORMS=0;
1028
- this.INITIAL_FORMS=0;
1029
- this.TOTAL_FORMS=0;
1030
- this.index=0;
1159
+ this.TOTAL_FORMS = 0;
1160
+ this.INITIAL_FORMS = 0;
1161
+ this.TOTAL_FORMS = 0;
1162
+ this.index = 0;
1031
1163
  this.updateManagementForm();
1032
1164
  }
1033
1165
  }
@@ -3,12 +3,12 @@
3
3
  <div class="row container mt-3">
4
4
 
5
5
  {% if form %}
6
- <div class="col col-md-9">
6
+ <div class="col-12 {{ distribution.0 }}">
7
7
  <form id="{{id}}_filter_form" class="row filter_form" onsubmit="return false;">
8
8
  {{form}}
9
9
  </form>
10
10
  </div>
11
- <div class="col col-md-3 p-3 ">
11
+ <div class="col-12 {{ distribution.1 }}">
12
12
  <div class="btn-group" role="group" aria-label="search">
13
13
  <button type="button" class="btn general_action btn-outline-primary" title="{% trans 'Search' %}"
14
14
  data-action="search">
@@ -55,7 +55,7 @@ class CalendarWidgetTest(TestCase):
55
55
  )
56
56
 
57
57
  def test_widget_events(self):
58
- self.assertEquals(self.calendarWidget.widget.events, self.events)
58
+ self.assertEqual(self.calendarWidget.widget.events, self.events)
59
59
 
60
60
  def test_calendar_attrs(self):
61
61
  self.assertDictEqual(self.calendarWidget.widget.calendar_attrs,
@@ -122,11 +122,11 @@ class FormCalendarWidgetTest(TestCase):
122
122
 
123
123
  def test_widget_id_form(self):
124
124
  calendar_id = self.render('{{form.calendar.id_for_label}}', {'form': self.form})
125
- self.assertEquals(calendar_id, 'id_calendar')
125
+ self.assertEqual(calendar_id, 'id_calendar')
126
126
 
127
127
  def test_events_src_input(self):
128
128
  calendar_name = self.render('{{form.calendar.html_name}}', {'form': self.form})
129
- self.assertEquals(calendar_name, 'calendar')
129
+ self.assertEqual(calendar_name, 'calendar')
130
130
 
131
131
  def test_widget_name_form(self):
132
132
  calendar_input = self.render('{{form}}', {'form': self.form})