I'm looking for a robust, stable django file manager for use in the django admin.
My requirements wish list:
I've used django-filebrowser (non-grappelli version) and also looked at (but not used) django-adminfiles. Both are very nice. But django-filebrowser requires using a custom field in my Models, plus I don't want the 'versions' (multiple image sizes) functionality. django-adminfiles is for inserting files as inlines into textareas, so is not what I'm looking for.
I'm happy to modify one of these to suit my needs, but would hate to do so if there are some other alternatives out there I'm missing.
FWIW, django-adminfiles also has buried in it some fledgling functionality to use the file-browser as a select-dropdown replacement: so your model would have a ForeignKey to the "FileUpload" model, and you'd get to browse to fill that ForeignKey. Is that closer to what you're looking for?
I haven't needed or used that feature in quite some time, it's not documented or tested, and there's been a lot of rewriting since I added it, so it may or may not be in working condition. But it's on my todo list to get it back in working condition one of these days, and I certainly wouldn't object to a little motivated help ;-)
As an addendum to @zlovelady 's answer, I also wanted to decouple django-filebrowser from my model definitions.
Maybe their code has changed since, but the recipe didn't quite work any more. I ended up with this to get it working (by sub-classing FileBrowserWidget):
from filebrowser.base import FileObject
from filebrowser.fields import FileBrowseWidget as fb_FileBrowseWidget
from filebrowser.sites import site as filebrowser_site
class FileBrowseWidget(fb_FileBrowseWidget):
def render(self, name, value, attrs=None):
if value is None:
value = ""
else:
value = FileObject(value.name, site=self.site)
return super(FileBrowseWidget, self).render(name, value, attrs)
class FileBrowseForm(forms.ModelForm):
# Use a CharField, not an ImageField or FileField, since filebrowser
# is handling any file uploading
image = forms.CharField(
required=True,
widget=FileBrowseWidget(attrs={'site':filebrowser_site})
)
I'm not using the no-grappelli version but I don't think it matters, the relevant code looked the same in both versions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With