Fixed #27942 -- Prevented admin from adding "add" buttons to all tables in inlines.
This commit is contained in:
parent
1fa47dc45a
commit
a0d29a9abe
|
@ -287,7 +287,7 @@
|
|||
$(inlineOptions.name + "-group .inline-related").stackedFormset(inlineOptions.options);
|
||||
break;
|
||||
case "tabular":
|
||||
$(inlineOptions.name + "-group .tabular.inline-related tbody tr").tabularFormset(inlineOptions.options);
|
||||
$(inlineOptions.name + "-group .tabular.inline-related tbody:first > tr").tabularFormset(inlineOptions.options);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -10,4 +10,4 @@ typeof SelectFilter&&(b(".selectfilter").each(function(b,a){var c=a.name.split("
|
|||
c.attr("maxlength"))})};a.formset({prefix:c.prefix,addText:c.addText,formCssClass:"dynamic-"+c.prefix,deleteCssClass:"inline-deletelink",deleteText:c.deleteText,emptyCssClass:"empty-form",removed:d,added:function(a){f(a);"undefined"!==typeof DateTimeShortcuts&&(b(".datetimeshortcuts").remove(),DateTimeShortcuts.init());e();d(a)},addButton:c.addButton});return a};b.fn.stackedFormset=function(c){var a=b(this),d=function(c){b(a.selector).find(".inline_label").each(function(a){a+=1;b(this).html(b(this).html().replace(/(#\d+)/g,
|
||||
"#"+a))})},e=function(){"undefined"!==typeof SelectFilter&&(b(".selectfilter").each(function(a,b){var c=b.name.split("-");SelectFilter.init(b.id,c[c.length-1],!1)}),b(".selectfilterstacked").each(function(a,b){var c=b.name.split("-");SelectFilter.init(b.id,c[c.length-1],!0)}))},f=function(a){a.find(".prepopulated_field").each(function(){var c=b(this).find("input, select, textarea"),d=c.data("dependency_list")||[],e=[];b.each(d,function(b,c){e.push("#"+a.find(".form-row .field-"+c).find("input, select, textarea").attr("id"))});
|
||||
e.length&&c.prepopulate(e,c.attr("maxlength"))})};a.formset({prefix:c.prefix,addText:c.addText,formCssClass:"dynamic-"+c.prefix,deleteCssClass:"inline-deletelink",deleteText:c.deleteText,emptyCssClass:"empty-form",removed:d,added:function(a){f(a);"undefined"!==typeof DateTimeShortcuts&&(b(".datetimeshortcuts").remove(),DateTimeShortcuts.init());e();d(a)},addButton:c.addButton});return a};b(document).ready(function(){b(".js-inline-admin-formset").each(function(){var c=b(this).data(),a=c.inlineFormset;
|
||||
switch(c.inlineType){case "stacked":b(a.name+"-group .inline-related").stackedFormset(a.options);break;case "tabular":b(a.name+"-group .tabular.inline-related tbody tr").tabularFormset(a.options)}})})})(django.jQuery);
|
||||
switch(c.inlineType){case "stacked":b(a.name+"-group .inline-related").stackedFormset(a.options);break;case "tabular":b(a.name+"-group .tabular.inline-related tbody:first > tr").tabularFormset(a.options)}})})})(django.jQuery);
|
||||
|
|
Loading…
Reference in New Issue