Browse Source

Odevzdávátko: fix JS formsetu

export_seznamu_prednasek
Pavel "LEdoian" Turinsky 4 years ago
parent
commit
d61f723636
  1. 5
      seminar/templates/seminar/odevzdavatko/detail.html

5
seminar/templates/seminar/odevzdavatko/detail.html

@ -26,8 +26,9 @@ function deleteForm(prefix, btn) {
if (total >= 1){ if (total >= 1){
btn.closest('tr').remove(); btn.closest('tr').remove();
var forms = $('.hodnoceni'); var forms = $('.hodnoceni');
$('#id_' + prefix + '-TOTAL_FORMS').val(forms.length); var formCount = forms.length - 1; // There is one extra such form hidden as template!
for (var i=0, formCount=forms.length; i<formCount; i++) { $('#id_' + prefix + '-TOTAL_FORMS').val(formCount);
for (var i=0; i<formCount; i++) {
$(forms.get(i)).find(':input').each(function() { $(forms.get(i)).find(':input').each(function() {
updateElementIndex(this, prefix, i); updateElementIndex(this, prefix, i);
}); });

Loading…
Cancel
Save