Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#13026 closed (fixed)

Problem with selecting related object from popup window, opened by lens icon in dynamic created inline row

Reported by: ramusus Owned by: nobody
Component: contrib.admin Version: 1.1
Severity: Keywords:
Cc: ramusus@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

With inline rows created by django's template everithing is ok, but I found problem with rows created dynamically. Problem with changing dynamic id in html containers of created row. Id of lens-icon-link defines incorrectly.

Attachments (3)

13026_r12676.diff (15.6 KB) - added by ramusus 7 years ago.
this patch only changes .find("input,select,textarea,label") > .find("input,select,textarea,label,a")
field_numbering_off_by_one.diff (3.9 KB) - added by Stefan Foulis 7 years ago.
adds a '-1' in both inlines.js and inlines.min.js
13026_r12676-2.diff (4.2 KB) - added by Rob Hudson 7 years ago.
Adding 'a' to the list of dom elements updateElementIndex is passed.

Download all attachments as: .zip

Change History (10)

Changed 7 years ago by ramusus

Attachment: 13026_r12676.diff added

this patch only changes .find("input,select,textarea,label") > .find("input,select,textarea,label,a")

comment:1 Changed 7 years ago by Stefan Foulis

it seems that the numbering on some fields is off by one. it's tricky, because the rows are numbered starting with 1 in the visible parts and the class of the element that surrounds each row. But the actual id's on the rows of the formset start with 0.
Adding a '-1' in the right spot in inlines.js fixed issue for me (with dropdown foreignkeys, the '+' add button and the raw id widget).
I attached a patch.

Changed 7 years ago by Stefan Foulis

adds a '-1' in both inlines.js and inlines.min.js

comment:2 Changed 7 years ago by ramusus

The problem is not a shift between number of row and id of elements inside this row for me. The problem is starting, when I create new rows dynamically and these rows has a lookup lens icon with link. Id for this link generated incorrectly and it's the reason of this ticket.

comment:3 Changed 7 years ago by Russell Keith-Magee

milestone: 1.2
Triage Stage: UnreviewedAccepted

comment:4 Changed 7 years ago by Rob Hudson

ramusus's patch made sense to me after reading the code. In the inlines.js there seems to be a cleanup method, updateElementIndex, and the anchor tag for the lens icon wasn't getting picked up by this method and its index wasn't correct. I will be attaching a patch, the same as ramusus, but without the extra spacing changes. This patch has been tested and works for me.

Changed 7 years ago by Rob Hudson

Attachment: 13026_r12676-2.diff added

Adding 'a' to the list of dom elements updateElementIndex is passed.

comment:5 Changed 7 years ago by Rob Hudson

Has patch: set

comment:6 Changed 7 years ago by Jannis Leidel

Resolution: fixed
Status: newclosed

(In [12784]) Fixed #13026 - Also update the index of lookup links when adding inlines dynmacially in the admin. Thanks to ramusus and Rob Hudson for the patch.

comment:7 Changed 5 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top