django-cms / django-filer

File and Image Management Application for django
https://django-filer.readthedocs.io/
Other
1.73k stars 575 forks source link

Related object popup not working in Django admin #1316

Closed ctrengove closed 1 year ago

ctrengove commented 1 year ago

Recent versions of Django have changed the way they "name" the popup window by appending a numeric index to the ID of the field in question. So instead of something like id_image_lookup, the popup window name becomes id_image_lookup__1. Apparently this is intended to allow multiple simultaneous popups for a single field.

This change means that the code in static/filer/js/addons/popup_handling.js no longer works, Specifically, the function dismissRelatedImageLookupPopup fails to retrieve the ID of the field being edited.

This looks like it can be fixed by adding the following line to windowname_to_id (in the same file).

text = text.replace(/__\d+$/, '');

This change to the Django admin was made on 30 Sep 2021, so I think the issue will be in 3.2.8 onwards. The relevant Django file is RelatedObjectLookups.js.

fsbraun commented 1 year ago

Solved by #1326