﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
15106	label[for] attributes aren't updated when dynamically creating new inlines	Matthias Kestenholz	nobody	"Processing for attributes too in inlines.js, addButton click handler fixes the problem.

Something like this:

{{{

diff --git a/django/contrib/admin/media/js/inlines.js b/django/contrib/admin/media/js/inlines.js
index cf79023..d9dc9cb 100644
--- a/django/contrib/admin/media/js/inlines.js
+++ b/django/contrib/admin/media/js/inlines.js
@@ -71,6 +71,14 @@
                                    .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));
+                                   })
+                                   .end()
+                                   .filter(function() {
+                                       var el = $(this);
                                        return el.attr(""name"") && el.attr(""name"").search(/__prefix__/) >= 0;
                                    }).each(function() {
                                        var el = $(this);
}}}


I'm not sure whether this is the best way to fix it, though. Processing a list of elements six times instead of once does not seem to make much sense to me.

This code isn't performance critical, though."		closed	contrib.admin	1.2		duplicate			Accepted	1	0	0	0	0	0
