#15106: label[for] attributes aren't updated when dynamically creating new inlines ----------------------------------+----------------------------------------- Reporter: mk | Owner: nobody Status: new | Milestone: 1.3 Component: django.contrib.admin | Version: 1.2 Keywords: | Stage: Unreviewed Has_patch: 1 | ----------------------------------+----------------------------------------- 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. -- Ticket URL: <http://code.djangoproject.com/ticket/15106> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.