Commit 35db1504 authored by Bryan  BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

bugfix in nested formset due to changes in templates that changed the position...

bugfix in nested formset due to changes in templates that changed the position of the input, searching not only in children
parent 552b582b
......@@ -23,7 +23,11 @@ function add_nested_form_to_nested_formset(source, prefix, parent_prefix){
.find(".formset-nested-item")[0]
.outerHTML;
current_item_name = $(source).closest(".formset-item").children("input")[0].name;
if($(source).closest(".formset-item").children("input").length>0){
current_item_name = $(source).closest(".formset-item").children("input")[0].name;
}else{
current_item_name = $(source).closest(".formset-item").children("div").children("input")[0].name;
}
current_item_name = current_item_name.substring(parent_prefix.length+1,current_item_name.indexOf('-',parent_prefix.length+1));
empty_form_as_str = empty_form_as_str.replace(
new RegExp(parent_prefix+"-__prefix__","g"),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment