Media-Management with Grappelli

Overview

Django FileBrowser

https://readthedocs.org/projects/django-filebrowser/badge/?version=latest

Media-Management with Grappelli.

The FileBrowser is an extension to the Django administration interface in order to:

  • browse directories on your server and upload/delete/edit/rename files.
  • include images/documents to your models/database using the FileBrowseField.
  • select images/documents with TinyMCE.

Requirements

FileBrowser 3.13.2 requires

Documentation

http://readthedocs.org/docs/django-filebrowser/

Translation

https://www.transifex.com/projects/p/django-filebrowser/

Releases

  • FileBrowser 3.13.2 (November 25th, 2020): Compatible with Django 3.1
  • FileBrowser 3.12.1 (November 14th, 2019): Compatible with Django 2.2 (LTS)
  • FileBrowser 3.9.2 (November 2nd, 2018): Compatible with Django 1.11 (LTS)

Current development branches:

  • FileBrowser 3.13.3 (Development Version for Django 3.0, see Branch Stable/3.13.x)
  • FileBrowser 3.12.2 (Development Version for Django 2.2, see Branch Stable/3.12.x)
  • FileBrowser 3.9.3 (Development Version for Django 1.11, see Branch Stable/3.9.x)

Older versions are available at GitHub, but are not supported anymore. Support for 3.12.x and 3.9.x is limited to security issues and very important bugfixes.

Comments
  • Directory does not exist

    Directory does not exist

    I'm running into an issue today getting Filebrowser running in my project. I've got it configures in all locations according to the docs for settings and urls. The only thing different about my setup is that I'm using django-storages with s3boto for our media. I have sites.storage set accordingly.

    This is the traceback I'm getting when trying to run the filebrowser tests:

    $ ./manage.py test filebrowser Traceback (most recent call last): File "./manage.py", line 14, in execute_manager(settings) File "/Users/greg/.virtualenvs/newyork.com/lib/python2.6/site-packages/django/core/management/init.py", line 438, in execute_manager utility.execute() File "/Users/greg/.virtualenvs/newyork.com/lib/python2.6/site-packages/django/core/management/init.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Users/greg/.virtualenvs/newyork.com/lib/python2.6/site-packages/django/core/management/base.py", line 191, in run_from_argv self.execute(_args, *_options.dict) File "/Users/greg/.virtualenvs/newyork.com/lib/python2.6/site-packages/django/core/management/base.py", line 220, in execute output = self.handle(_args, *_options) File "/Users/greg/.virtualenvs/newyork.com/lib/python2.6/site-packages/south/management/commands/test.py", line 8, in handle super(Command, self).handle(_args, *_kwargs) File "/Users/greg/.virtualenvs/newyork.com/lib/python2.6/site-packages/django/core/management/commands/test.py", line 37, in handle failures = test_runner.run_tests(test_labels) File "/Users/greg/.virtualenvs/newyork.com/lib/python2.6/site-packages/django/test/simple.py", line 358, in run_tests suite = self.build_suite(test_labels, extra_tests) File "/Users/greg/.virtualenvs/newyork.com/lib/python2.6/site-packages/django/test/simple.py", line 248, in build_suite suite.addTest(build_suite(app)) File "/Users/greg/.virtualenvs/newyork.com/lib/python2.6/site-packages/django/test/simple.py", line 77, in build_suite test_module = get_tests(app_module) File "/Users/greg/.virtualenvs/newyork.com/lib/python2.6/site-packages/django/test/simple.py", line 35, in get_tests test_module = import('.'.join(app_path + [TEST_MODULE]), {}, {}, TEST_MODULE) File "/Users/greg/.virtualenvs/newyork.com/src/django-filebrowser/filebrowser/tests/init.py", line 2, in from filebrowser.tests.base import FileObjectPathTests, FileObjectVersionTests, FileObjectUnicodeTests File "/Users/greg/.virtualenvs/newyork.com/src/django-filebrowser/filebrowser/tests/base.py", line 17, in from filebrowser.sites import site File "/Users/greg/.virtualenvs/newyork.com/src/django-filebrowser/filebrowser/sites.py", line 524, in site = FileBrowserSite(name='filebrowser') File "/Users/greg/.virtualenvs/newyork.com/src/django-filebrowser/filebrowser/sites.py", line 109, in init self.directory = DIRECTORY File "/Users/greg/.virtualenvs/newyork.com/src/django-filebrowser/filebrowser/sites.py", line 118, in _directory_set raise ImproperlyConfigured("Directory '%(dir)s' for the site %(app_name)s.%(name)s does not exist." % {'dir': val, 'app_name': self.app_name, 'name': self.name}) django.core.exceptions.ImproperlyConfigured: Directory '/Users/greg/dev/newyork.com/newyork/../static/filebrowser/' for the site filebrowser.filebrowser does not exist.

    opened by gregnewman 43
  • Allow custom versions without VERSIONS definition

    Allow custom versions without VERSIONS definition

    This PR enables the usage of django-filebrowser with django-image-cropping, as proposed in #313.

    There's another PR to the django-image-cropping project in order to provide the other side of the integration, with django-filebrowser as an backend.

    Highlights:

    1. Replaces the direct call to utils.scale_and_crop by a stack of "processor functions" that are configurable on settings using FILEBROWSER_PROCESSORS, with the default pointing to scale_and_crop.
    2. Allow override the FileBrowseWidget using Admin.formfield_overrides param widget.
    3. FileBrowseWidget now renders data-* attributes on the <input> tag.
    4. FileObject.version_generate param version_suffix is not required to be in VERSIONS anymore, any suffix should work, if the new extra_options param contains enough data to generate a version.
    5. New concept of namers to delegate the construction of a version filename, and deconstruct a version filename back to the original. The FILEBROWSER_VERSION_NAMER setting points to the default namer filebrowser.namers.VersionNamer.
    6. namers.VersionNamer: A namer that acts like the current behaviour of django-filebrowser, generating names based on the VERSIONS dict and version_suffix.
    7. namers.OptionsNamer: A namer that generates an unique name using the options provided to the FileObject.version_generate and the options in VERSIONS if an version_suffix is provided. Restores the original file name wipping out the last _version_suffix--plus-any-configs block entirely.
    8. Replaces FileObject.is_version verfification to only verify if the file is in VERSIONS_BASEDIR since with the namers there's no guarantee that the version file name is a subset of VERSIONS keys.

    Motivations behind the design decisions:

    1. FILEBROWSER_PROCESSORS is required in order to register the crop_corners processor. A processor that crops an image based on a box that is stored on ImageRadioFields.
    2. Allow override the FileBrowseWidget is required because django-image-cropping has the custom widget mixin CropWidget that generates meta-data from the source image field (now allowing FileBrowserField) and put that meta-data into data-* attributes, requiring the FileBrowseWidget to render those attrs into the <input> tag.
    3. Since django-image-cropping should potentially generates many versions from the same original source image, there's no concept of version_prefix, all information required to generate a version is on the call stack, so I created the extra_options to hold that data, that is mixed with the VERSION if version_suffix exists.
    4. Any box (edges to generate a crop) should generate an unique file name, so the concept of namers was used. It's from the easy_thubnails.namers.

    Please let me know what do you think, and anything that I could improve.

    Best regards,

    discussion 3.7 
    opened by fgmacedo 25
  • Refactored versions functionality to filebrowser.versions

    Refactored versions functionality to filebrowser.versions

    • Using the default site from filebrowser.versions.sites is equivalent to using the old one
    • Using the default site from filebrowser.sites is a stripped down version without versions and admin thumbnails
    • Both admin interfaces seem fully functional
    • filebrowser.tests passing
    • filebrowser.versions.tests.sites are failing, tests URL resolver don't work after moving the site to a different module.
    • FileBrowserField is now a base class without previews, VersionFileBrowserField provided

    I couldn't figure out how the test suite in sites.py actually work. They stopped working after moving the site to a versions module, the tests apparently can't resolve the installed site and fail with a KeyError on APP_NAME. The admin is fully functional though.

    Can you help me making those tests pass? Also, tests for FileBrowserField are needed.

    To install and test this branch:

    • Adding filebrowser to INSTALLED_APPS and using the old filebrowser.sites.site on urls.py will provide a stripped down version
    • Adding both filebrowser and filebrowser.versions to INSTALLED_APPS and using filebrowser.versions.sites.site will provide the equivalent of the current version
    • VersionFileBrowserField is provided, FileBrowserField is now a base class without previewing functionality
    opened by hcarvalhoalves 22
  • Django File Upload Handlers are completely bypassed?

    Django File Upload Handlers are completely bypassed?

    I'm not sure if this is the intended behaviour or not. But right now it seems filebrowser is completely bypassing django's upload handlers. Looking at fileuploader.js it seems the content-type "application/octet-stream" causes this.

    See line 358: https://github.com/django/django/blob/1.4.2/django/http/init.py

    This isn't a problem for small uploads but uploading anything larger than a few MB's makes memory usage go through the roof.

    opened by rmmr 15
  • Thumbnails are not produced in 3.6.1

    Thumbnails are not produced in 3.6.1

    Tests: ERROR ( ···· EEEEEE....FE.....EEE.................. ···· FAILED (failures=1, errors=11) ) Version: ( ···· FileBrowser 3.6.1, Grappelli 2.7.1, Django 1.8.3, ···· Python 2.7.6, Pillow 2.9.0 ) apt-get libraries for images/files: ( ···· libjpeg8, libjpeg8-dev, zlib1g-dev, libfreetype6, ···· libfreetype6-dev, libjpeg-turbo8, libjpeg-turbo8-dev, libpng12-dev )

    SUMMARY

    Filebrowser fails silently from GUI at generating versions (just 404 errors are seen when running python manage.py runserver). However, I can see the original image is uploaded to STATIC_ROOT/uploads - and accessible via web browser aiming to STATIC_URL -, but versions are not generated at STATIC_ROOT/_versions folder.

    DETAILS

    - relevant settings in `myproject/settings.py` - The whole output of `python manage.py test filebrowser`

    I'm not sure if I did anything wrong with myproject/settings.py, so here I post the relevant settings for django-filebrowser:

    INSTALLED_APPS = (
        'grappelli',
        'filebrowser',
        'modeltranslation',
        # ...
    )
    
    FILEBROWSER_DIRECTORY = "static/uploads/"
    FILEBROWSER_VERSIONS_BASEDIR = "static/_versions"
    FILEBROWSER_VERSIONS = {
            'admin_thumbnail': {'verbose_name': 'Admin Thumbnail', 'width': 60, 'height': 60, 'opts': 'crop'},
            'thumbnail': {'verbose_name': 'Thumbnail (1 col)', 'width': 60, 'height': 60, 'opts': 'crop'},
            'small': {'verbose_name': 'Small (2 col)', 'width': 140, 'height': '', 'opts': ''},
            'medium': {'verbose_name': 'Medium (4col )', 'width': 300, 'height': '', 'opts': ''},
            'big': {'verbose_name': 'Big (6 col)', 'width': 460, 'height': '', 'opts': ''},
            'large': {'verbose_name': 'Large (8 col)', 'width': 680, 'height': '', 'opts': ''},
    
            # ...long story short...       
    
            'my_custom': {'verbose_name': 'Large (8 col)', 'width': 1202, 'height': 100, 'opts': 'crop'},
    }
    
    FILEBROWSER_DIRECTORY = "static/uploads/"
    FILEBROWSER_VERSIONS_BASEDIR = "static/_versions"
    
    STATICFILES_DIRS = (
           os.path.join(PROJECT_DIR, "static"),
           os.path.join(BASE_DIR, "static/admin/js"),
           os.path.join(BASE_DIR, "static/*"),
    )
    
    # XXX HACK This is ugly because it overrides the default behaviour
    # ........ of Django, but it worked for me to fix Grappelli's GUI
    STATICFILES_FINDERS = (
           'django.contrib.staticfiles.finders.AppDirectoriesFinder',
           'django.contrib.staticfiles.finders.FileSystemFinder',
    )
    

    When I perform the tests, the results seem completely catastrophic. It called my attention the fact that tests seem to be looking for PIL(which is deprecated and NOT installed in my machine):

    ('Creating Test for the FileBrowser site:', 'filebrowser')
    Creating test database for alias 'default'...
    EEEEEE....FE.....EEE..................
    Select a version you want to generate:
     * large
     * admin_thumbnail
    (leave blank to generate all versions): generating version "large" for: fb_test_directory/fb_tmp_dir/fb_tmp_dir_sub/testimage.jpg
    E.
    ======================================================================
    ERROR: runTest (filebrowser.tests.test_sites.TestSite_filebrowser)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_sites.py", line 438, in runTest
        test_browse(self)
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_sites.py", line 47, in test_browse
        response = test.c.get(url)
      File "/venvs/mdrcms/lib/python2.7/site-packages/django/test/client.py", line 500, in get
        **extra)
      File "/venvs/mdrcms/lib/python2.7/site-packages/django/test/client.py", line 303, in get
        return self.generic('GET', path, secure=secure, **r)
      File "/venvs/mdrcms/lib/python2.7/site-packages/django/test/client.py", line 379, in generic
        return self.request(**r)
      File "/venvs/mdrcms/lib/python2.7/site-packages/django/test/client.py", line 466, in request
        six.reraise(*exc_info)
      File "/venvs/mdrcms/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
        response = wrapped_callback(request, *callback_args, **callback_kwargs)
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/decorators.py", line 45, in decorator
        return function(request, *args, **kwargs)
      File "/venvs/mdrcms/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 22, in _wrapped_view
        return view_func(request, *args, **kwargs)
      File "/venvs/mdrcms/lib/python2.7/site-packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func
        response = view_func(request, *args, **kwargs)
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/sites.py", line 349, in browse
        }, context_instance=Context(request, current_app=self.name))
      File "/venvs/mdrcms/lib/python2.7/site-packages/django/shortcuts.py", line 45, in render_to_response
        using=using)
      File "/venvs/mdrcms/lib/python2.7/site-packages/django/template/loader.py", line 116, in render_to_string
        template_name, context, context_instance, dirs, dictionary)
      File "/venvs/mdrcms/lib/python2.7/site-packages/django/template/engine.py", line 221, in render_to_string
        return t.render(context_instance)
      File "/venvs/mdrcms/lib/python2.7/site-packages/django/template/base.py", line 208, in render
        with context.bind_template(self):
      File "/usr/bin/python2.7.9/lib/python2.7/contextlib.py", line 17, in __enter__
        return self.gen.next()
      File "/venvs/mdrcms/lib/python2.7/site-packages/django/template/context.py", line 241, in bind_template
        updates.update(processor(self.request))
      File "/venvs/mdrcms/mdrcms/coreapp/context.py", line 11, in navbar
        current_siteman = SiteManager.objects.get(id=current_site.id)
      File "/venvs/mdrcms/lib/python2.7/site-packages/django/db/models/manager.py", line 127, in manager_method
        return getattr(self.get_queryset(), name)(*args, **kwargs)
      File "/venvs/mdrcms/lib/python2.7/site-packages/django/db/models/query.py", line 334, in get
        self.model._meta.object_name
    DoesNotExist: SiteManager matching query does not exist.
    
    ======================================================================
    ERROR: test_scale_crop (filebrowser.tests.test_versions.VersionTemplateTagsTests)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_versions.py", line 44, in setUp
        self.original_placeholder = filebrowser.templatetags.fb_versions.PLACEHOLDER
    AttributeError: 'module' object has no attribute 'fb_versions'
    
    ======================================================================
    ERROR: test_version (filebrowser.tests.test_versions.VersionTemplateTagsTests)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_versions.py", line 44, in setUp
        self.original_placeholder = filebrowser.templatetags.fb_versions.PLACEHOLDER
    AttributeError: 'module' object has no attribute 'fb_versions'
    
    ======================================================================
    ERROR: test_version_as_object (filebrowser.tests.test_versions.VersionTemplateTagsTests)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_versions.py", line 44, in setUp
        self.original_placeholder = filebrowser.templatetags.fb_versions.PLACEHOLDER
    AttributeError: 'module' object has no attribute 'fb_versions'
    
    ======================================================================
    ERROR: test_version_object (filebrowser.tests.test_versions.VersionTemplateTagsTests)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_versions.py", line 44, in setUp
        self.original_placeholder = filebrowser.templatetags.fb_versions.PLACEHOLDER
    AttributeError: 'module' object has no attribute 'fb_versions'
    
    ======================================================================
    ERROR: test_version_setting (filebrowser.tests.test_versions.VersionTemplateTagsTests)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_versions.py", line 44, in setUp
        self.original_placeholder = filebrowser.templatetags.fb_versions.PLACEHOLDER
    AttributeError: 'module' object has no attribute 'fb_versions'
    
    ======================================================================
    ERROR: test_delete (filebrowser.tests.test_base.FileObjectAttributeTests)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_base.py", line 438, in test_delete
        f_version = self.f_image.version_generate("large")
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/base.py", line 506, in version_generate
        version_path = self._generate_version(version_suffix)
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/base.py", line 527, in _generate_version
        version = scale_and_crop(im, VERSIONS[version_suffix]['width'], VERSIONS[version_suffix]['height'], VERSIONS[version_suffix]['opts'])
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/utils.py", line 85, in scale_and_crop
        im = im.resize((int(math.ceil(x * r)), int(math.ceil(y * r))), resample=Image.ANTIALIAS)
      File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/Image.py", line 1557, in resize
        self.load()
      File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/ImageFile.py", line 203, in load
        d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
      File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/Image.py", line 420, in _getdecoder
        raise IOError("decoder %s not available" % decoder_name)
    IOError: decoder jpeg not available
    
    ======================================================================
    ERROR: test_version_attributes_1 (filebrowser.tests.test_base.FileObjectAttributeTests)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_base.py", line 317, in test_version_attributes_1
        f_version = self.f_image.version_generate("large")
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/base.py", line 506, in version_generate
        version_path = self._generate_version(version_suffix)
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/base.py", line 527, in _generate_version
        version = scale_and_crop(im, VERSIONS[version_suffix]['width'], VERSIONS[version_suffix]['height'], VERSIONS[version_suffix]['opts'])
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/utils.py", line 85, in scale_and_crop
        im = im.resize((int(math.ceil(x * r)), int(math.ceil(y * r))), resample=Image.ANTIALIAS)
      File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/Image.py", line 1557, in resize
        self.load()
      File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/ImageFile.py", line 203, in load
        d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
      File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/Image.py", line 420, in _getdecoder
        raise IOError("decoder %s not available" % decoder_name)
    IOError: decoder jpeg not available
    
    ======================================================================
    ERROR: test_version_attributes_2 (filebrowser.tests.test_base.FileObjectAttributeTests)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_base.py", line 362, in test_version_attributes_2
        f_version = self.f_image.version_generate("large")
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/base.py", line 506, in version_generate
        version_path = self._generate_version(version_suffix)
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/base.py", line 527, in _generate_version
        version = scale_and_crop(im, VERSIONS[version_suffix]['width'], VERSIONS[version_suffix]['height'], VERSIONS[version_suffix]['opts'])
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/utils.py", line 85, in scale_and_crop
        im = im.resize((int(math.ceil(x * r)), int(math.ceil(y * r))), resample=Image.ANTIALIAS)
      File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/Image.py", line 1557, in resize
        self.load()
      File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/ImageFile.py", line 203, in load
        d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
      File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/Image.py", line 420, in _getdecoder
        raise IOError("decoder %s not available" % decoder_name)
    IOError: decoder jpeg not available
    
    ======================================================================
    ERROR: test_version_attributes_3 (filebrowser.tests.test_base.FileObjectAttributeTests)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_base.py", line 408, in test_version_attributes_3
        f_version = self.f_image.version_generate("large")
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/base.py", line 506, in version_generate
        version_path = self._generate_version(version_suffix)
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/base.py", line 527, in _generate_version
        version = scale_and_crop(im, VERSIONS[version_suffix]['width'], VERSIONS[version_suffix]['height'], VERSIONS[version_suffix]['opts'])
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/utils.py", line 85, in scale_and_crop
        im = im.resize((int(math.ceil(x * r)), int(math.ceil(y * r))), resample=Image.ANTIALIAS)
      File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/Image.py", line 1557, in resize
        self.load()
      File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/ImageFile.py", line 203, in load
        d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
      File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/Image.py", line 420, in _getdecoder
        raise IOError("decoder %s not available" % decoder_name)
    IOError: decoder jpeg not available
    
    ======================================================================
    ERROR: test_fb_version_generate (filebrowser.tests.test_commands.CommandsTests)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_commands.py", line 99, in test_fb_version_generate
        call_command('fb_version_generate', 'fb_test_directory')
      File "/venvs/mdrcms/lib/python2.7/site-packages/django/core/management/__init__.py", line 120, in call_command
        return command.execute(*args, **defaults)
      File "/venvs/mdrcms/lib/python2.7/site-packages/django/core/management/base.py", line 444, in execute
        output = self.handle(*args, **options)
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/management/commands/fb_version_generate.py", line 68, in handle
        versionobject = fileobject.version_generate(selected_version)  # FIXME force?
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/base.py", line 506, in version_generate
        version_path = self._generate_version(version_suffix)
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/base.py", line 527, in _generate_version
        version = scale_and_crop(im, VERSIONS[version_suffix]['width'], VERSIONS[version_suffix]['height'], VERSIONS[version_suffix]['opts'])
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/utils.py", line 85, in scale_and_crop
        im = im.resize((int(math.ceil(x * r)), int(math.ceil(y * r))), resample=Image.ANTIALIAS)
      File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/Image.py", line 1557, in resize
        self.load()
      File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/ImageFile.py", line 203, in load
        d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
      File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/Image.py", line 420, in _getdecoder
        raise IOError("decoder %s not available" % decoder_name)
    IOError: decoder jpeg not available
    
    ======================================================================
    FAIL: test_walk (filebrowser.tests.test_base.FileListingTests)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_base.py", line 584, in test_walk
        self.assertEqual(list(f.path for f in self.f_listing.files_walk_total()), [u'fb_test_directory/testimage.jpg', u'fb_test_directory/fb_tmp_dir', u'fb_test_directory/fb_tmp_dir/fb_tmp_dir_sub', u'fb_test_directory/fb_tmp_dir/fb_tmp_dir_sub/testimage.jpg'])
    AssertionError: Lists differ: [u'fb_test_directory/testimage... != [u'fb_test_directory/testimage...
    
    First differing element 1:
    fb_test_directory/fb_tmp_dir/fb_tmp_dir_sub
    fb_test_directory/fb_tmp_dir
    
      [u'fb_test_directory/testimage.jpg',
    +  u'fb_test_directory/fb_tmp_dir',
       u'fb_test_directory/fb_tmp_dir/fb_tmp_dir_sub',
    -  u'fb_test_directory/fb_tmp_dir/fb_tmp_dir_sub/testimage.jpg',
    ?                                                              ^
    
    +  u'fb_test_directory/fb_tmp_dir/fb_tmp_dir_sub/testimage.jpg']
    ?                                                              ^
    
    -  u'fb_test_directory/fb_tmp_dir']
    
    ----------------------------------------------------------------------
    Ran 40 tests in 1.790s
    
    FAILED (failures=1, errors=11)
    Destroying test database for alias 'default'...
    

    I wonder why are tests looking for PIL if it is a deprecated library, and even the README file says that Pillow has to be used instead...

    opened by SebasSBM 14
  • Select format doesn't work

    Select format doesn't work

    Hi When I am adding a field like these:

    FileBrowseField('testfield', format='media', max_length=255, blank=True)
    

    or

    FileBrowseField('testfield', format='image', max_length=255, blank=True)
    

    It shows 0 result to me, but when I am adding like these:

    FileBrowseField('testfield', format='Video', max_length=255, blank=True)
    
    FileBrowseField('testfield', format='Image', max_length=255, blank=True)
    

    It works OK, It seems you are looking for EXTENSIONS setting for format argument instead of SELECT_FORMATS setting. I think the extensions argument should look for EXTENSIONS setting (only if its value is a string) and format argument should look SELECT_FORMATS setting. Thank you.

    opened by sharifzadesina 13
  • No module named defaults (DJango 1.6)

    No module named defaults (DJango 1.6)

    Request Method: GET Request URL: http://localhost:8008/administracao/ Django Version: 1.6 Exception Type: ImportError Exception Value:

    No module named defaults

    Exception Location: /usr/local/envs/expoimob/local/lib/python2.7/site-packages/filebrowser/sites.py in get_urls, line 123

    3.5 
    opened by lzanuz 13
  • No thumbs generated on the list (S3)

    No thumbs generated on the list (S3)

    On /admin/filebrowser/browse/ I can't see images thumbs. I installed grappelli etc strict as documentation says. All works fine except thumb. Their generated HTML source looks that:

    <td class="fb_thumbnail">
        <a href="/site_media/media/uploads/c7e2b502ad416f525fa38cb94dfcd933.png" class="fb_viewlink"><img src="" title="Zobacz obraz"></a>
    </td>```
    
    EDIT:
    does not generate thumbs in virtualenv.
    
    discussion 
    opened by tunarob 12
  • Do not filter version images if VERSIONS_BASEDIR is in use

    Do not filter version images if VERSIONS_BASEDIR is in use

    If VERSIONS_BASEDIR is specified, there is no need to filter file list while browsing directory. I use VERSIONS_BASEDIR to guarantee that user is unable to upload file incorrectly recognized as version file (and being hidden in browse view). Without this commit, user uploaded file "product_list_index.pdf" is hidden when there is "index" image VERSION.

    3.6 
    opened by cuchac 11
  • Wrong FilePath if running server on Win

    Wrong FilePath if running server on Win

    In order to reproduce you need to run Django with Grapelli & FileBrowser on a Windows machine

    1. Find a ImageField
    2. Click Browse to open FileBrowser
    3. Create a subdirectory
    4. Click the subdirectory (you will see that the dir-query has backwards slash, due to Win)
    5. Have an image on your hard drive that starts with letter "t"
    6. Upload the image into the subdirectory
    7. Click "Select"

    You will now see a malformed string with "t" being replaced with tab character (javascript \t)

    opened by kunambi 11
  • Rescale Bug Fix

    Rescale Bug Fix

    Hi,

    I consider this a bug. I had the following situation: There was an image that was 61x59 px and I made a version preset with a size of 60x30 px. It did not rescale the image, even though I expecet it to do so. When I changed the version size to 64x32 px, it did rescale the image. This is my suggestion to fix it.

    opened by TripleWhy 10
  • Bump wheel from 0.37.1 to 0.38.1 in /tests

    Bump wheel from 0.37.1 to 0.38.1 in /tests

    Bumps wheel from 0.37.1 to 0.38.1.

    Changelog

    Sourced from wheel's changelog.

    Release Notes

    UNRELEASED

    • Updated vendored packaging to 22.0

    0.38.4 (2022-11-09)

    • Fixed PKG-INFO conversion in bdist_wheel mangling UTF-8 header values in METADATA (PR by Anderson Bravalheri)

    0.38.3 (2022-11-08)

    • Fixed install failure when used with --no-binary, reported on Ubuntu 20.04, by removing setup_requires from setup.cfg

    0.38.2 (2022-11-05)

    • Fixed regression introduced in v0.38.1 which broke parsing of wheel file names with multiple platform tags

    0.38.1 (2022-11-04)

    • Removed install dependency on setuptools
    • The future-proof fix in 0.36.0 for converting PyPy's SOABI into a abi tag was faulty. Fixed so that future changes in the SOABI will not change the tag.

    0.38.0 (2022-10-21)

    • Dropped support for Python < 3.7
    • Updated vendored packaging to 21.3
    • Replaced all uses of distutils with setuptools
    • The handling of license_files (including glob patterns and default values) is now delegated to setuptools>=57.0.0 (#466). The package dependencies were updated to reflect this change.
    • Fixed potential DoS attack via the WHEEL_INFO_RE regular expression
    • Fixed ValueError: ZIP does not support timestamps before 1980 when using SOURCE_DATE_EPOCH=0 or when on-disk timestamps are earlier than 1980-01-01. Such timestamps are now changed to the minimum value before packaging.

    0.37.1 (2021-12-22)

    • Fixed wheel pack duplicating the WHEEL contents when the build number has changed (#415)
    • Fixed parsing of file names containing commas in RECORD (PR by Hood Chatham)

    0.37.0 (2021-08-09)

    • Added official Python 3.10 support
    • Updated vendored packaging library to v20.9

    ... (truncated)

    Commits
    • 6f1608d Created a new release
    • cf8f5ef Moved news item from PR #484 to its proper place
    • 9ec2016 Removed install dependency on setuptools (#483)
    • 747e1f6 Fixed PyPy SOABI parsing (#484)
    • 7627548 [pre-commit.ci] pre-commit autoupdate (#480)
    • 7b9e8e1 Test on Python 3.11 final
    • a04dfef Updated the pypi-publish action
    • 94bb62c Fixed docs not building due to code style changes
    • d635664 Updated the codecov action to the latest version
    • fcb94cd Updated version to match the release
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Files with more than one extension (examples: .tar.gz, .tar.xz) are not permitted by _isAllowedExtension in filebrowser.js

    Files with more than one extension (examples: .tar.gz, .tar.xz) are not permitted by _isAllowedExtension in filebrowser.js

    If a programmer configures django-filebrowser in settings.py like so:

    FILEBROWSER_EXTENSIONS = {
        ...,  # other entries elided
        'Archive': ['.zip', '.tar', '.tar.gz', '.tar.xz']
    }
    

    ...then a user will be shown the error: typeError: "{file} has invalid extension. Only {extensions} are allowed." when trying to upload a compressed tarball.

    This is because _isAllowedExtension() sees myFile.tar.gz as simply ending in .gz, which is not in allowedExtensions.

    _isAllowedExtension: function(fileName){
    
        // this trims ".tar.gz" to ".gz"
        var ext = (-1 !== fileName.indexOf('.')) ? fileName.substr(fileName.lastIndexOf('.')).toLowerCase() : '';
    
        var allowed = this._options.allowedExtensions;
    
        if (!allowed.length){return true;}        
        
        for (var i=0; i<allowed.length; i++){
            if (allowed[i].toLowerCase() == ext){ return true;}    
        }
        
        return false;
    }, 
    

    The naive solution is to change FILEBROWSER_EXTENSIONS to accept .xz or .gz (or whatever relevant extension). However, I would argue that this is problematic, as simply accepting all files ending in .gz or .xz is not the same as only accepting .tar.gz or .tar.xz.


    Possible solution

    (please note I have almost no JavaScript experience and haven't tested this)

    _isAllowedExtension: function(fileName){
    
        var fileNameLower = fileName.toLowerCase()
    
        var allowed = this._options.allowedExtensions;
        if (!allowed.length){return true;}        
        
        for (var i=0; i<allowed.length; i++){
            if (fileNameLower.endsWith(allowed[i].toLowerCase())){ return true;}    
        }
        
        return false;
    }, 
    

    Edit 1: formatting

    Edit 2: add permalink to source code

    opened by afparsons 1
  • Add extra context

    Add extra context

    Add the ability to push extra context: example

    def add_extra_context(self, request):
        
        query = request.GET.copy()
    
        if not query.get('pop'):
            from django.contrib.admin.sites import site
            return {
                'is_popup': query.get('pop'),
                'is_nav_sidebar_enabled': not query.get('pop'),
                'app_full_list': site.get_app_list(request),
            }
        else:
            return {}
      
    FileBrowserSite.add_extra_context = add_extra_context
    
    # My Custom FileBrowser site
    custom_site = FileBrowserSite(name='custom_filebrowser', storage=DefaultStorage())
    
    
    opened by Fethienv 0
  • Add a `--force` flag to `python manage.py fb_version_generate`

    Add a `--force` flag to `python manage.py fb_version_generate`

    I notice there are a couple of references to a --force flag in the fb_version_generate code, e.g.: https://github.com/sehmaschine/django-filebrowser/blob/6686ffeb00bac1779539992d7bea6253522606f2/filebrowser/management/commands/fb_version_generate.py#L70

    This would be a useful addition. Would you be happy to accept a pull request for that? Thanks

    opened by andylolz 0
  • adding videos thumbnails support

    adding videos thumbnails support

    I have added video thumbnail support, and going to add more features soon. Will add:

    • Video Trailer
    • Video Versions (different resolutions)
    • IS_STAFF_PERM_REQUIRED in settings
    • Normal user can browse only his folders and files

    Thank you :)

    opened by xstag 1
Owner
Patrick Kranzlmueller
Patrick Kranzlmueller
Social Media Network Focuses On Data Security And Being Community Driven Web App

privalise Social Media Network Focuses On Data Security And Being Community Driven Web App The Main Idea: We`ve seen social media web apps that focuse

Privalise 8 Jun 25, 2021
django social media app with real time features

django-social-media django social media app with these features: signup, login and old registered users are saved by cookies posts, comments, replies,

null 8 Apr 30, 2022
This is a repository for collecting global custom management extensions for the Django Framework.

Django Extensions Django Extensions is a collection of custom extensions for the Django Framework. Getting Started The easiest way to figure out what

Django Extensions 6k Dec 26, 2022
A django integration for huey task queue that supports multi queue management

django-huey This package is an extension of huey contrib djhuey package that allows users to manage multiple queues. Installation Using pip package ma

GAIA Software 32 Nov 26, 2022
Django-Audiofield is a simple app that allows Audio files upload, management and conversion to different audio format (mp3, wav & ogg), which also makes it easy to play audio files into your Django application.

Django-Audiofield Description: Django Audio Management Tools Maintainer: Areski Contributors: list of contributors Django-Audiofield is a simple app t

Areski Belaid 167 Nov 10, 2022
File and Image Management Application for django

Django Filer django Filer is a file management application for django that makes handling of files and images a breeze. Contributing This is a an open

django CMS Association 1.6k Dec 28, 2022
django Filer is a file management application for django that makes handling of files and images a breeze.

django Filer is a file management application for django that makes handling of files and images a breeze.

django CMS Association 1.6k Jan 6, 2023
A Django Online Library Management Project.

Why am I doing this? I started learning ?? Django few months back, and this is a practice project from MDN Web Docs that touches the aspects of Django

null 1 Nov 13, 2021
simple project management tool for educational purposes

Taskcamp This software is used for educational and demonstrative purposes. It's a simple project management tool powered by Django Framework Install B

Ilia Dmitriev 6 Nov 8, 2022
A Blog Management System Built with django

Blog Management System Backend use: Django Features Enhanced Ui

Vishal Goswami 1 Dec 6, 2021
AUES Student Management System Developed for laboratory works №9 Purpose using Python (Django).

AUES Student Management System (L M S ) AUES Student Management System Developed for laboratory works №9 Purpose using Python (Django). I've created t

ANAS NABIL 2 Dec 6, 2021
A task management system created using Django 4.0 and Python 3.8 for a hackathon.

Task Management System A task management app for Projects created using Django v4.0 and Python 3.8 for educational purpose. This project was created d

Harsh Agarwal 1 Dec 12, 2021
This repository contains django library management system project.

Library Management System Django ** INSTALLATION** First of all install python on your system. Then run pip install -r requirements.txt to required se

whoisdinanath 1 Dec 26, 2022
Drf-stripe-subscription - An out-of-box Django REST framework solution for payment and subscription management using Stripe

Drf-stripe-subscription - An out-of-box Django REST framework solution for payment and subscription management using Stripe

Oscar Y Chen 68 Jan 7, 2023
Advanced school management system written in Django :)

Advanced school management system written in Django :) ⚙️ Config the project First you should make venv for this project. So in the main root of proje

AminAli Mazarian 72 Dec 5, 2022
A Student/ School management application built using Django and Python.

Student Management An awesome student management app built using Django.! Explore the docs » View Demo · Report Bug · Request Feature Table of Content

Nishant Sethi 1 Feb 10, 2022
ProjectManagementWebsite - Project management website for CMSC495 built using the Django stack

ProjectManagementWebsite A minimal project management website for CMSC495 built

Justin 1 May 23, 2022
Fully Automated YouTube Channel ▶️with Added Extra Features.

Fully Automated Youtube Channel ▒█▀▀█ █▀▀█ ▀▀█▀▀ ▀▀█▀▀ █░░█ █▀▀▄ █▀▀ █▀▀█ ▒█▀▀▄ █░░█ ░░█░░ ░▒█░░ █░░█ █▀▀▄ █▀▀ █▄▄▀ ▒█▄▄█ ▀▀▀▀ ░░▀░░ ░▒█░░ ░▀▀▀ ▀▀▀░

sam-sepiol 249 Jan 2, 2023
google-resumable-media Apache-2google-resumable-media (🥉28 · ⭐ 27) - Utilities for Google Media Downloads and Resumable.. Apache-2

google-resumable-media Utilities for Google Media Downloads and Resumable Uploads See the docs for examples and usage. Experimental asyncio Support Wh

Google APIs 36 Nov 22, 2022
A pure python media player that can be used in AI media API development.

A pure python media player that can be used in AI media API development.

YDOOK 1 Dec 4, 2021