Opened 3 months ago
Last modified 2 months ago
#35911 assigned Bug
FilteredSelectMultiple Widget Not Functional in Inline Formset After Form Deletion
Reported by: | ulr0 | Owned by: | Alanna Cao |
---|---|---|---|
Component: | contrib.admin | Version: | 4.2 |
Severity: | Normal | Keywords: | inlines, SelectFilter2, FilteredSelectMultiple |
Cc: | ulr0 | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | yes |
Pull Requests: | 18903 | ||
Description ¶
In the Django admin interface, when using an inline formset that includes a FilteredSelectMultiple widget,
deleting a form causes the FilteredSelectMultiple widget below the deleted form to become non-functional.
It appears that this issue may stem from how the id attribute index is dynamically updated when forms are added or deleted.
The SelectFilter event listener seems to register the initial id at the time of SelectFilter creation.
When the id changes, the event listener does not update, which causes the filter functionality to break.
Steps to Reproduce:
- Open an inline formset in the Django admin that contains a FilteredSelectMultiple widget.
- Delete one of the forms within the inline formset.
- Observe that the FilteredSelectMultiple widget below the deleted form no longer functions correctly, with the filtering feature disabled.
Video Demonstration: A video demonstrating this issue can be found here. (https://drive.google.com/file/d/17zkF5I7Cf5NMW2_qU1vroPm8ef6ukyDl/view?usp=sharing)
According to the ticket's flags, the next step(s) to move this issue forward are:
- To improve the patch as described in the pull request review comments or on this ticket, then uncheck "Patch needs improvement".
If creating a new pull request, include a link to the pull request in the ticket comment when making that update. The usual format is:
[https://github.com/django/django/pull/#### PR]
.
Change History (5)
comment:1 by , 3 months ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 3 months ago
Cc: | added |
---|
comment:3 by , 3 months ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:4 by , 2 months ago
Has patch: | set |
---|
comment:5 by , 2 months ago
Patch needs improvement: | set |
---|
Replicated on main, thank you for the report!