add: ukládání různých bodů
This commit is contained in:
parent
39da362586
commit
d9756d5f60
2 changed files with 14 additions and 0 deletions
|
@ -49,8 +49,18 @@ $(document).ready(function(){
|
||||||
$('#id_form-' + form_idx + '-deadline_body')[0].value = $('#id_form-' + (form_idx - 1) + '-deadline_body')[0].value
|
$('#id_form-' + form_idx + '-deadline_body')[0].value = $('#id_form-' + (form_idx - 1) + '-deadline_body')[0].value
|
||||||
}
|
}
|
||||||
$('#id_form-TOTAL_FORMS').val(parseInt(form_idx) + 1);
|
$('#id_form-TOTAL_FORMS').val(parseInt(form_idx) + 1);
|
||||||
|
|
||||||
|
$('.bodovani').children().change(function(){
|
||||||
|
$(this).parent().parent().children(".bodovani").children().attr("disabled", true);
|
||||||
|
$(this).attr("disabled", false);
|
||||||
|
})
|
||||||
});
|
});
|
||||||
$('.smazat_hodnoceni').click(function(){
|
$('.smazat_hodnoceni').click(function(){
|
||||||
deleteForm("form",this);
|
deleteForm("form",this);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.bodovani').children().change(function(){
|
||||||
|
$(this).parent().parent().children(".bodovani").children().attr("disabled", true);
|
||||||
|
$(this).attr("disabled", false);
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
|
@ -308,6 +308,10 @@ def hodnoceniReseniView(request, pk, *args, **kwargs):
|
||||||
**form.cleaned_data,
|
**form.cleaned_data,
|
||||||
)
|
)
|
||||||
logger.info(f"Creating Hodnoceni: {hodnoceni}")
|
logger.info(f"Creating Hodnoceni: {hodnoceni}")
|
||||||
|
zmeny_bodu = [it for it in form.changed_data if it.startswith("body")]
|
||||||
|
if len(zmeny_bodu) == 1:
|
||||||
|
hodnoceni.__setattr__(zmeny_bodu[0], data_for_body[zmeny_bodu[0]])
|
||||||
|
hodnoceni.save()
|
||||||
hodnoceni.save()
|
hodnoceni.save()
|
||||||
|
|
||||||
return redirect(success_url)
|
return redirect(success_url)
|
||||||
|
|
Loading…
Reference in a new issue