error in inlines.js from row 327, method document.onready
How to reproduce:
1. Create admin form with any inline.
2. Open change form in browser, сopy whole html tag with class=".js-
inline-admin-formset" and with childs.
3. Override admin/change_form.html and add copy html part from 2. before
admin form. Of cause all "id" in tags should be unique.
Now every time if change_form is opened, inlines.js made wrong
add_new_inline_object link.
Why:
in inlines.js any methods stackedFormset or tabularFormset don't check
"id" from formset and add link to any formset with childs with class
"...-group" and ".inline-related".
Has Patch: yes.
{{{
// django\contrib\admin\static\admin\js\inlines.js
// row 335:
$(selector).stackedFormset(selector, inlineOptions.options);
// change to
$(this).find("[id^=" + inlineOptions.name.substring(1) +
"-]").stackedFormset(selector, inlineOptions.options);
// rows 338-339:
selector = inlineOptions.name + "-group .tabular.inline-related
tbody:first > tr.form-row";
$(selector).tabularFormset(selector, inlineOptions.options);
// change to
selector = inlineOptions.name + "-group .tabular.inline-related
tbody:first > tr[id^=" + inlineOptions.name.substring(1) + "-].form-row ";
$(this).children().tabularFormset(selector, inlineOptions.options);
}}}
I only add "id" from every inline in jquery selector.
This is not impossible situation, i include additional inline for my needs
directly in html, and founded this bug.
--
Ticket URL: <https://code.djangoproject.com/ticket/33394>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* type: Bug => Cleanup/optimization
* has_patch: 1 => 0
* resolution: => invalid
Comment:
> This is not impossible situation, i include additional inline for my
needs directly in html, and founded this bug.
Thanks for the report, however I don't think it's something that we would
like (or need) to support.
--
Ticket URL: <https://code.djangoproject.com/ticket/33394#comment:1>
* status: closed => new
* resolution: invalid =>
Comment:
inline.js has a bug: document.onready add link to wrong html tag.
It can be reproduced, and it has patch.
Why it should be not changed?
--
Ticket URL: <https://code.djangoproject.com/ticket/33394#comment:2>
* status: new => closed
* resolution: => invalid
Comment:
Because, as far as I'm aware it's not a supported scenario. If you can
provide a sample project that reproduces this issue without steps based on
manual modification of the generated HTML, then we can reconsider this
decision.
--
Ticket URL: <https://code.djangoproject.com/ticket/33394#comment:3>