Allow to enter edit form of django filer's file from widget

Hi,

Alongside the canonical url slug evolution, I want to allow user to enter django filer’s “edit file” form in a popup with a button in the file cms plugin widget.

In this screenshot the pencil icon now open the /admin/filer/file/<file-id>/change/ URL in a popup.
The file button open the lookup popup as usual. (I’ve just changed the icon)

Using right css classes on button link, and _popup=1 query param in URL, this is working pretty well, the popup is opened and closed on save.
But I didn’t find a way to bind a custom JavaScript function on popup close. So for now I can’t update the widget values. (specially the file name which isn’t updated when changed in form)

What is your opinion and feeling on this addition ? Do you know why this is not already present ?

I know django admin is internally using a dismissChangeRelatedObjectPopup function, called when change popups are closed. But it only goal is to update the select widget of foreignkey fields.

May be it is too hard to customize django admin to this point ?

If this is a evolution is welcome, I will be glad to work on it. But maybe I will need to talk with a django admin expert on how to resolve this “callback” issue.

Thanks

I’ve succeed to have a callback by overriding popup_response.html with a custom one :tada:

PR submitted here: feat: open edit file popup from file widget by fabien-michel · Pull Request #1301 · django-cms/django-filer · GitHub