Opened 15 years ago

Closed 15 years ago

Last modified 13 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: no UI/UX: no

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 15 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 15 years ago.
adds a '-1' in both inlines.js and inlines.min.js
13026_r12676-2.diff (4.2 KB ) - added by Rob Hudson 15 years ago.
Adding 'a' to the list of dom elements updateElementIndex is passed.

Download all attachments as: .zip

Change History (10)

by ramusus, 15 years ago

Attachment: 13026_r12676.diff added

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

comment:1 by Stefan Foulis, 15 years ago

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.

by Stefan Foulis, 15 years ago

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

comment:2 by ramusus, 15 years ago

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 by Russell Keith-Magee, 15 years ago

milestone: 1.2
Triage Stage: UnreviewedAccepted

comment:4 by Rob Hudson, 15 years ago

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.

by Rob Hudson, 15 years ago

Attachment: 13026_r12676-2.diff added

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

comment:5 by Rob Hudson, 15 years ago

Has patch: set

comment:6 by Jannis Leidel, 15 years ago

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 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

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