theatlantic / django-nested-admin

Django admin classes that allow for nested inlines
http://django-nested-admin.readthedocs.org/
Other
690 stars 97 forks source link

Regexp is not replacing __prefix__ with object when string is used as argument for inline js function #160

Open danielce opened 4 years ago

danielce commented 4 years ago

django-nested-admin > 3.1.4 is not working correctly with django-filebrowser. It is due to changed regexp for replacing prefix with id of the object. Django-filebrowser uses this rendered id as argument for function to show filebrowser window. It seems that new regexp is not handling replacing string if that string is used inside js function call - see the example below:

<input id="id_cad_models-10-file" type="text" class="vFileBrowseField" name="cad_models-10-file" value=""><a href="javascript:FileBrowser.show('id_cad_models-__prefix__-file', '/admin/filebrowser/browse/?pop=1&amp;dir=products');" class="fb_show"></a> Tested with configuration as follows: django-nested-admin==3.2.4 django-filebrowser==3.12.1 Django==2.2.7

fdintino commented 4 years ago

Thanks for the bug report. Could you post a simplified example of how you're using filebrowser inside an inline, so I can write a regression test for this?