django-filebrowser-no-grappelli
django-filebrowser-no-grappelli copied to clipboard
Inlines problem
When I try to use a filebrowser in inlines inside admin, it doesn't catch the correct id for the field, because it leaves prefix in the id instead replacing the number of the inline.
I've seen that it returns that error only for new inlines. because inlines.js doesn't replace this piece of code prefix
Thank you for the bug report.
I haven't tried using file browser fields in inlines so I'm afraid I can't help much. Sounds like it would also be an issue for upstream.
I just ran into this and made a quick fix by modifying inlines.js and including it in the page after the original django version. add this bit starting at line 78.
.end()
.filter(function() {
var el = $(this).next();
return el.attr("href") && el.attr("href").search(/__prefix__/) >= 0;
}).each(function() {
var el = $(this).next();
el.attr("href", el.attr("href").replace(/__prefix__/g, nextIndex));
});
great, send me a patch or pull request and I'll include it
Hi, I have commited a fix (for tabular inlines only at the moment). The trick is to override the tabular inline template and add a post-add hook in the javascript to correct the field id in the filebrowser function call. See:
https://github.com/aleray/django-filebrowser-no-grappelli/commit/1c3389bfae7c595ea20005498944e4545e7b9e0e