Index: django/django/contrib/admin/media/js/inlines.min.js
===================================================================
--- django/django/contrib/admin/media/js/inlines.min.js	(revision 12677)
+++ django/django/contrib/admin/media/js/inlines.min.js	(working copy)
@@ -1,5 +1,5 @@
 (function(a){a.fn.formset=function(f){var b=a.extend({},a.fn.formset.defaults,f),l=function(d,e,j){var c=new RegExp("("+e+"-\\d+)");e=e+"-"+j;a(d).attr("for")&&a(d).attr("for",a(d).attr("for").replace(c,e));if(d.id)d.id=d.id.replace(c,e);if(d.name)d.name=d.name.replace(c,e)};f=a("#id_"+b.prefix+"-TOTAL_FORMS").attr("autocomplete","off");var h=a("#id_"+b.prefix+"-MAX_NUM_FORMS").attr("autocomplete","off");f=h.val()==0||h.val()-f.val()>0;a(this).each(function(){a(this).not("."+b.emptyCssClass).addClass(b.formCssClass)});
 if(a(this).length&&f){var i;if(a(this).attr("tagName")=="TR"){f=this.eq(0).children().length;a(this).parent().append('<tr class="'+b.addCssClass+'"><td colspan="'+f+'"><a href="javascript:void(0)">'+b.addText+"</a></tr>");i=a(this).parent().find("tr:last a")}else{a(this).filter(":last").after('<div class="'+b.addCssClass+'"><a href="javascript:void(0)">'+b.addText+"</a></div>");i=a(this).filter(":last").next().find("a")}i.click(function(){var d=a("#id_"+b.prefix+"-TOTAL_FORMS"),e=parseInt(d.val())+
 1,j=a("#"+b.prefix+"-empty"),c=j.clone(true).get(0);a(c).removeClass(b.emptyCssClass).removeAttr("id").insertBefore(a(j));a(c).html(a(c).html().replace(/__prefix__/g,e));a(c).addClass(b.formCssClass).attr("id",b.prefix+e);if(a(c).is("TR"))a(c).children(":last").append('<div><a class="'+b.deleteCssClass+'" href="javascript:void(0)">'+b.deleteText+"</a></div>");else a(c).is("UL")||a(c).is("OL")?a(c).append('<li><a class="'+b.deleteCssClass+'" href="javascript:void(0)">'+b.deleteText+"</a></li>"):a(c).children(":first").append('<span><a class="'+
-b.deleteCssClass+'" href="javascript:void(0)">'+b.deleteText+"</a></span>");a(c).find("input,select,textarea,label").each(function(){l(this,b.prefix,d.val())});a(d).val(e);h.val()!=0&&h.val()<=d.val()&&i.parent().hide();a(c).find("a."+b.deleteCssClass).click(function(){var g=a(this).parents("."+b.formCssClass);g.remove();b.removed&&b.removed(g);g=a("."+b.formCssClass);a("#id_"+b.prefix+"-TOTAL_FORMS").val(g.length);if(h.val()==0||h.val()>=g.length)i.parent().show();for(var k=0,m=g.length;k<m;k++)a(g.get(k)).find("input,select,textarea,label").each(function(){l(this,
+b.deleteCssClass+'" href="javascript:void(0)">'+b.deleteText+"</a></span>");a(c).find("input,select,textarea,label,a").each(function(){l(this,b.prefix,d.val())});a(d).val(e);h.val()!=0&&h.val()<=d.val()&&i.parent().hide();a(c).find("a."+b.deleteCssClass).click(function(){var g=a(this).parents("."+b.formCssClass);g.remove();b.removed&&b.removed(g);g=a("."+b.formCssClass);a("#id_"+b.prefix+"-TOTAL_FORMS").val(g.length);if(h.val()==0||h.val()>=g.length)i.parent().show();for(var k=0,m=g.length;k<m;k++)a(g.get(k)).find("input,select,textarea,label,a").each(function(){l(this,
 b.prefix,k)});return false});b.added&&b.added(a(c));return false})}return this};a.fn.formset.defaults={prefix:"form",addText:"add another",deleteText:"remove",addCssClass:"add-row",deleteCssClass:"delete-row",emptyCssClass:"empty-row",formCssClass:"dynamic-form",added:null,removed:null}})(jQuery);
Index: django/django/contrib/admin/media/js/inlines.js
===================================================================
--- django/django/contrib/admin/media/js/inlines.js	(revision 12677)
+++ django/django/contrib/admin/media/js/inlines.js	(working copy)
@@ -15,116 +15,116 @@
  * See: http://www.opensource.org/licenses/bsd-license.php
  */
 (function($) {
-	$.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 replacement = prefix + "-" + ndx;
-			if ($(el).attr("for")) {
-				$(el).attr("for", $(el).attr("for").replace(id_regex, replacement));
-			}
-			if (el.id) {
-				el.id = el.id.replace(id_regex, replacement);
-			}
-			if (el.name) {
-				el.name = el.name.replace(id_regex, replacement);
-			}
-		};
-		var totalForms = $("#id_" + options.prefix + "-TOTAL_FORMS").attr("autocomplete", "off");
-		var maxForms = $("#id_" + options.prefix + "-MAX_NUM_FORMS").attr("autocomplete", "off");
-		// only show the add button if we are allowed to add more items
-		var showAddButton = ((maxForms.val() == 0) || ((maxForms.val()-totalForms.val()) > 0));
-		$(this).each(function(i) {
-			$(this).not("." + options.emptyCssClass).addClass(options.formCssClass);
-		});
-		if ($(this).length && showAddButton) {
-			var addButton;
-			if ($(this).attr("tagName") == "TR") {
-				// If forms are laid out as table rows, insert the
-				// "add" button in a new table row:
-				var numCols = this.eq(0).children().length;
-				$(this).parent().append('<tr class="' + options.addCssClass + '"><td colspan="' + numCols + '"><a href="javascript:void(0)">' + options.addText + "</a></tr>");
-				addButton = $(this).parent().find("tr:last a");
-			} else {
-				// Otherwise, insert it immediately after the last form:
-				$(this).filter(":last").after('<div class="' + options.addCssClass + '"><a href="javascript:void(0)">' + options.addText + "</a></div>");
-				addButton = $(this).filter(":last").next().find("a");
-			}
-			addButton.click(function() {
-				var totalForms = $("#id_" + options.prefix + "-TOTAL_FORMS");
-				var nextIndex = parseInt(totalForms.val()) + 1;
-				var template = $("#" + options.prefix + "-empty");
-				var row = template.clone(true).get(0);
-				$(row).removeClass(options.emptyCssClass).removeAttr("id").insertBefore($(template));
-				$(row).html($(row).html().replace(/__prefix__/g, nextIndex));
-				$(row).addClass(options.formCssClass).attr("id", options.prefix + nextIndex);
-				if ($(row).is("TR")) {
-					// If the forms are laid out in table rows, insert
-					// the remove button into the last table cell:
-					$(row).children(":last").append('<div><a class="' + options.deleteCssClass +'" href="javascript:void(0)">' + options.deleteText + "</a></div>");
-				} else if ($(row).is("UL") || $(row).is("OL")) {
-					// If they're laid out as an ordered/unordered list,
-					// insert an <li> after the last list item:
-					$(row).append('<li><a class="' + options.deleteCssClass +'" href="javascript:void(0)">' + options.deleteText + "</a></li>");
-				} else {
-					// Otherwise, just insert the remove button as the
-					// 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").each(function() {
-					updateElementIndex(this, options.prefix, totalForms.val());
-				});
-				// Update number of total forms
-				$(totalForms).val(nextIndex);
-				// Hide add button in case we've hit the max, except we want to add infinitely
-				if ((maxForms.val() != 0) && (maxForms.val() <= totalForms.val())) {
-					addButton.parent().hide();
-				}
-				// The delete button of each row triggers a bunch of other things
-				$(row).find("a." + options.deleteCssClass).click(function() {
-					// Remove the parent form containing this button:
-					var row = $(this).parents("." + options.formCssClass);
-					row.remove();
-					// If a post-delete callback was provided, call it with the deleted form:
-					if (options.removed) {
-						options.removed(row);
-					}
-					// Update the TOTAL_FORMS form count.
-					var forms = $("." + options.formCssClass);
-					$("#id_" + options.prefix + "-TOTAL_FORMS").val(forms.length);
-					// Show add button again once we drop below max
-					if ((maxForms.val() == 0) || (maxForms.val() >= forms.length)) {
-						addButton.parent().show();
-					}
-					// Also, update names and ids for all remaining form controls
-					// so they remain in sequence:
-					for (var i=0, formCount=forms.length; i<formCount; i++)
-					{
-						$(forms.get(i)).find("input,select,textarea,label").each(function() {
-							updateElementIndex(this, options.prefix, i);
-						});
-					}
-					return false;
-				});
-				// If a post-add callback was supplied, call it with the added form:
-				if (options.added) {
-					options.added($(row));
-				}
-				return false;
-			});
-		}
-		return this;
-	}
-	/* Setup plugin defaults */
-	$.fn.formset.defaults = {
-		prefix: "form",					// The form prefix for your django formset
-		addText: "add another",			// Text for the add link
-		deleteText: "remove",			// Text for the delete link
-		addCssClass: "add-row",			// CSS class applied to the add link
-		deleteCssClass: "delete-row",	// CSS class applied to the delete link
-		emptyCssClass: "empty-row",		// CSS class applied to the empty row
-		formCssClass: "dynamic-form",	// CSS class applied to each form in a formset
-		added: null,					// Function called each time a new form is added
-		removed: null					// Function called each time a form is deleted
-	}
+    $.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 replacement = prefix + "-" + ndx;
+            if ($(el).attr("for")) {
+                $(el).attr("for", $(el).attr("for").replace(id_regex, replacement));
+            }
+            if (el.id) {
+                el.id = el.id.replace(id_regex, replacement);
+            }
+            if (el.name) {
+                el.name = el.name.replace(id_regex, replacement);
+            }
+        };
+        var totalForms = $("#id_" + options.prefix + "-TOTAL_FORMS").attr("autocomplete", "off");
+        var maxForms = $("#id_" + options.prefix + "-MAX_NUM_FORMS").attr("autocomplete", "off");
+        // only show the add button if we are allowed to add more items
+        var showAddButton = ((maxForms.val() == 0) || ((maxForms.val()-totalForms.val()) > 0));
+        $(this).each(function(i) {
+            $(this).not("." + options.emptyCssClass).addClass(options.formCssClass);
+        });
+        if ($(this).length && showAddButton) {
+            var addButton;
+            if ($(this).attr("tagName") == "TR") {
+                // If forms are laid out as table rows, insert the
+                // "add" button in a new table row:
+                var numCols = this.eq(0).children().length;
+                $(this).parent().append('<tr class="' + options.addCssClass + '"><td colspan="' + numCols + '"><a href="javascript:void(0)">' + options.addText + "</a></tr>");
+                addButton = $(this).parent().find("tr:last a");
+            } else {
+                // Otherwise, insert it immediately after the last form:
+                $(this).filter(":last").after('<div class="' + options.addCssClass + '"><a href="javascript:void(0)">' + options.addText + "</a></div>");
+                addButton = $(this).filter(":last").next().find("a");
+            }
+            addButton.click(function() {
+                var totalForms = $("#id_" + options.prefix + "-TOTAL_FORMS");
+                var nextIndex = parseInt(totalForms.val()) + 1;
+                var template = $("#" + options.prefix + "-empty");
+                var row = template.clone(true).get(0);
+                $(row).removeClass(options.emptyCssClass).removeAttr("id").insertBefore($(template));
+                $(row).html($(row).html().replace(/__prefix__/g, nextIndex));
+                $(row).addClass(options.formCssClass).attr("id", options.prefix + nextIndex);
+                if ($(row).is("TR")) {
+                    // If the forms are laid out in table rows, insert
+                    // the remove button into the last table cell:
+                    $(row).children(":last").append('<div><a class="' + options.deleteCssClass +'" href="javascript:void(0)">' + options.deleteText + "</a></div>");
+                } else if ($(row).is("UL") || $(row).is("OL")) {
+                    // If they're laid out as an ordered/unordered list,
+                    // insert an <li> after the last list item:
+                    $(row).append('<li><a class="' + options.deleteCssClass +'" href="javascript:void(0)">' + options.deleteText + "</a></li>");
+                } else {
+                    // Otherwise, just insert the remove button as the
+                    // 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() {
+                    updateElementIndex(this, options.prefix, totalForms.val());
+                });
+                // Update number of total forms
+                $(totalForms).val(nextIndex);
+                // Hide add button in case we've hit the max, except we want to add infinitely
+                if ((maxForms.val() != 0) && (maxForms.val() <= totalForms.val())) {
+                    addButton.parent().hide();
+                }
+                // The delete button of each row triggers a bunch of other things
+                $(row).find("a." + options.deleteCssClass).click(function() {
+                    // Remove the parent form containing this button:
+                    var row = $(this).parents("." + options.formCssClass);
+                    row.remove();
+                    // If a post-delete callback was provided, call it with the deleted form:
+                    if (options.removed) {
+                        options.removed(row);
+                    }
+                    // Update the TOTAL_FORMS form count.
+                    var forms = $("." + options.formCssClass);
+                    $("#id_" + options.prefix + "-TOTAL_FORMS").val(forms.length);
+                    // Show add button again once we drop below max
+                    if ((maxForms.val() == 0) || (maxForms.val() >= forms.length)) {
+                        addButton.parent().show();
+                    }
+                    // Also, update names and ids for all remaining form controls
+                    // 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() {
+                            updateElementIndex(this, options.prefix, i);
+                        });
+                    }
+                    return false;
+                });
+                // If a post-add callback was supplied, call it with the added form:
+                if (options.added) {
+                    options.added($(row));
+                }
+                return false;
+            });
+        }
+        return this;
+    }
+    /* Setup plugin defaults */
+    $.fn.formset.defaults = {
+        prefix: "form",                    // The form prefix for your django formset
+        addText: "add another",            // Text for the add link
+        deleteText: "remove",            // Text for the delete link
+        addCssClass: "add-row",            // CSS class applied to the add link
+        deleteCssClass: "delete-row",    // CSS class applied to the delete link
+        emptyCssClass: "empty-row",        // CSS class applied to the empty row
+        formCssClass: "dynamic-form",    // CSS class applied to each form in a formset
+        added: null,                    // Function called each time a new form is added
+        removed: null                    // Function called each time a form is deleted
+    }
 })(jQuery);
