Opened 5 years ago

Closed 5 years ago

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

Download all attachments as: .zip

Change History (10)

Changed 5 years ago by ramusus

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

comment:1 Changed 5 years ago by stefanfoulis

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 5 years ago by stefanfoulis

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

comment:2 Changed 5 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 5 years ago by russellm

  • milestone set to 1.2
  • Triage Stage changed from Unreviewed to Accepted

comment:4 Changed 5 years ago by robhudson

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 5 years ago by robhudson

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

comment:5 Changed 5 years ago by robhudson

  • Has patch set

comment:6 Changed 5 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

(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 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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