Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you recommend a good django file manager for the admin? [closed]

I'm looking for a robust, stable django file manager for use in the django admin.

My requirements wish list:

  1. Allows browsing and selecting files on the server (e.g. images)
  2. Allows uploading files. Multiple file upload would be great (with, e.g. uploadify)
  3. Does not require me to use a custom field in my model definitions (like django-filebrowser does). I want something that can ideally be attached to a CharField (or ImageField of FileField) in admin.py, like Carl Meyer's django-adminfiles.

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.

like image 720
zlovelady Avatar asked Jan 09 '10 05:01

zlovelady


2 Answers

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 ;-)

like image 108
Carl Meyer Avatar answered Sep 17 '22 12:09

Carl Meyer


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.

like image 36
Anentropic Avatar answered Sep 18 '22 12:09

Anentropic