--- Django-1.3-rc-1/django/contrib/admin/media/js/inlines.js.orig	2011-03-15 17:18:34.000000000 +0100
+++ Django-1.3-rc-1/django/contrib/admin/media/js/inlines.js	2011-03-16 16:51:16.000000000 +0100
@@ -18,7 +18,7 @@
 	$.fn.formset = function(opts) {
 		var options = $.extend({}, $.fn.formset.defaults, opts);
 		var updateElementIndex = function(el, prefix, ndx) {
-			var id_regex = new RegExp("(" + prefix + "-\\d+)");
+			var id_regex = new RegExp("(" + prefix + "-(\\d+|__prefix__))");
 			var replacement = prefix + "-" + ndx;
 			if ($(el).attr("for")) {
 				$(el).attr("for", $(el).attr("for").replace(id_regex, replacement));
@@ -60,30 +60,6 @@
 				    .addClass(options.formCssClass)
 				    .attr("id", options.prefix + "-" + nextIndex);
 				nextIndex += 1;
-				row.find("*")
-				    .filter(function() {
-				        var el = $(this);
-				        return el.attr("id") && el.attr("id").search(/__prefix__/) >= 0;
-				    }).each(function() {
-				        var el = $(this);
-				        el.attr("id", el.attr("id").replace(/__prefix__/g, nextIndex));
-				    })
-				    .end()
-				    .filter(function() {
-				        var el = $(this);
-				        return el.attr("name") && el.attr("name").search(/__prefix__/) >= 0;
-				    }).each(function() {
-				        var el = $(this);
-				        el.attr("name", el.attr("name").replace(/__prefix__/g, nextIndex));
-				    })
-				    .end()
-				    .filter(function() {
-				        var el = $(this);
-				        return el.attr("for") && el.attr("for").search(/__prefix__/) >= 0;
-				    }).each(function() {
-				        var el = $(this);
-				        el.attr("for", el.attr("for").replace(/__prefix__/g, nextIndex));
-				    });
 				if (row.is("tr")) {
 					// If the forms are laid out in table rows, insert
 					// the remove button into the last table cell:
@@ -97,7 +73,7 @@
 					// last child element of the form's container:
 					row.children(":first").append('<span><a class="' + options.deleteCssClass + '" href="javascript:void(0)">' + options.deleteText + "</a></span>");
 				}
-				row.find("input,select,textarea,label,a").each(function() {
+				row.find("*").each(function() {
 					updateElementIndex(this, options.prefix, totalForms.val());
 				});
 				// Insert the new form when it has been fully edited
@@ -128,7 +104,7 @@
 					// so they remain in sequence:
 					for (var i=0, formCount=forms.length; i<formCount; i++)
 					{
-						$(forms.get(i)).find("input,select,textarea,label,a").each(function() {
+						$(forms.get(i)).find("*").each(function() {
 							updateElementIndex(this, options.prefix, i);
 						});
 					}
