Skip to content

Commit

Permalink
Merge branch 'upstream-3.6.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
smacker committed Nov 10, 2015
2 parents 6f3be17 + 9a4d0c6 commit 95773ff
Show file tree
Hide file tree
Showing 43 changed files with 614 additions and 236 deletions.
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ The FileBrowser is an extension to the `Django <http://www.djangoproject.com>`_
Requirements
------------

FileBrowser 3.5 requires
FileBrowser 3.6 requires

* Django 1.4/1.5/1.6/1.7 (http://www.djangoproject.com)
* Django 1.4/1.5/1.6/1.7/1.8 (http://www.djangoproject.com)
* Pillow (https://github.com/python-imaging/Pillow)

No Grappelli
Expand Down Expand Up @@ -52,7 +52,7 @@ https://www.transifex.com/projects/p/django-filebrowser/
Releases
--------

* FileBrowser 3.5.9 (Development Version, not yet released, see Branch Stable/3.5.x)
* FileBrowser 3.5.8 (November 8th, 2015): Compatible with Django 1.4/1.5/1.6/1.7
* FileBrowser 3.6.2 (Development Version, not yet released, master branch)
* FileBrowser 3.6.1 (November 11th, 2015): Compatible with Django 1.4/1.5/1.6/1.7/1.8

Older versions are available at GitHub, but are not supported anymore.
32 changes: 10 additions & 22 deletions docs/admin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ The main |filebrowser| admin application is an extension for the Django admin in
FileBrowser Site
----------------

.. versionadded:: 3.4.0
.. class:: FileBrowserSite(name=None, app_name='filebrowser', storage=default_storage)

.. py:class:: FileBrowserSite(name=None, app_name='filebrowser', storage=default_storage)
Respresents the FileBrowser admin application (similar to Django's admin site).

:param name: A name for the site, defaults to None.
Expand All @@ -31,7 +29,7 @@ FileBrowser Site
Similar to ``django.contrib.admin``, you first need to add a ``filebrowser.site`` to your admin interface. In your ``urls.py``, import the default FileBrowser site (or your custom site) and add the site to your URL-patterns (before any admin-urls)::

from filebrowser.sites import site

urlpatterns = patterns('',
url(r'^adminurl/filebrowser/', include(site.urls)),
)
Expand All @@ -42,7 +40,7 @@ Now you are able to browse the location defined with the storage engine associat
from django.core.files.storage import DefaultStorage
from filebrowser.sites import FileBrowserSite
# Default FileBrowser site
site = FileBrowserSite(name='filebrowser', storage=DefaultStorage())
Expand All @@ -58,8 +56,6 @@ Now you are able to browse the location defined with the storage engine associat
Custom Actions
--------------

.. versionadded:: 3.4.0

Similar to Django's admin actions, you can define your |fb| actions and thus automate the typical tasks of your users. Registered custom actions are listed in the detail view of a file and a user can select a single action at a time. The selected action will then be applied to the file.

The default |fb| image actions, such as "Flip Vertical" or "Rotate 90° Clockwise" are in fact implemented as custom actions (see the module ``filebrowser.actions``).
Expand Down Expand Up @@ -104,7 +100,7 @@ Messages & Intermediate Pages
You can provide a feedback to a user about a successful or failed execution of an action by using a message. For example::

from django.contrib import messages

def desaturate_image(request, fileobjects):
for f in fileobjects:
# Desaturate the image
Expand All @@ -121,8 +117,6 @@ Some actions may require user confirmation (e.g., in order to prevent accidental
File Storages
-------------

.. versionadded:: 3.4.0

You have the option to specify which file storage engine a |fb| should use to browse/upload/modify your media files. This enables you to use a |fb| even if your media files are located at some remote system. See also the Django's documentation on storages https://docs.djangoproject.com/en/dev/topics/files/.

To associate a |site| with a particular storage engine, set the ``storage`` property of a site object::
Expand All @@ -132,12 +126,6 @@ To associate a |site| with a particular storage engine, set the ``storage`` prop

For storage classes other than FileSystemStorage (or those that inherit from that class), there's more effort involved in providing a storage object that can be used with |fb|. See :ref:`mixin`

.. note::
Prior |fb| 3.4, the way to specify |fb|'s MEDIA_ROOT and MEDIA_URL was via settings.py. Starting from version 3.4, those variables are associated with the storage instance and you can set them as illustrated in the above example.

.. warning::
For the reason of backward compatibility, |fb| settings FILEBROWSER_MEDIA_ROOT and FILEBROWSER_MEDIA_URL can still be used to customize |fb| as long as you're using the default |fb|'s site without having changed its storage engine. In the next major release of |fb| these settings will be removed.

.. _mixin:

StorageMixin Class
Expand All @@ -150,15 +138,15 @@ A |fb| uses the Django's Storage class to access media files. However, the API o
Returns true if name exists and is a directory.

.. function:: isfile(self, name)

Returns true if name exists and is a regular file.

.. function:: move(self, old_file_name, new_file_name, allow_overwrite=False)
Moves safely a file from one location to another. If ``allow_ovewrite==False`` and ``new_file_name`` exists, raises an exception.

Moves safely a file from one location to another. If ``allow_ovewrite==False`` and ``new_file_name`` exists, raises an exception.

.. function:: makedirs(self, name)

Creates all missing directories specified by name. Analogue to os.mkdirs().

.. _views:
Expand Down Expand Up @@ -265,15 +253,15 @@ Example for using these Signals
Here's a small example for using the above Signals::

from filebrowser import signals

def pre_upload_callback(sender, **kwargs):
"""
Receiver function called before an upload starts.
"""
print "Pre Upload Callback"
print "kwargs:", kwargs
signals.filebrowser_pre_upload.connect(pre_upload_callback)

def post_upload_callback(sender, **kwargs):
"""
Receiver function called each time an upload has finished.
Expand Down
9 changes: 7 additions & 2 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@
Changelog
=========

3.5.9 (not yet released)
3.6.2 (not yet released)
------------------------

3.6.1 (November 11th, 2015)
---------------------------

* Compatibility with Django 1.8

3.5.8 (November 8th 2015)
--------------------------

Expand Down Expand Up @@ -150,4 +155,4 @@ Changelog
3.4.0 (15/11/2011)
------------------

* Final release of 3.4, see :ref:`releasenotes`
For further information, see :ref:`releasenotes`.
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@

# General information about the project.
project = u'Django FileBrowser'
copyright = u'2011, Patrick Kranzlmueller'
copyright = u'2015, Patrick Kranzlmueller'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '3.5.8'
version = '3.6.1'
# The full version, including alpha/beta/rc tags.
release = '3.5.8'
release = '3.6.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
4 changes: 2 additions & 2 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The |filebrowser| is about managing files. We think that you should prepare your
How do I upload to another server?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Use a custom storage engine, see https://docs.djangoproject.com/en/1.6/howto/custom-file-storage/.
Use a custom storage engine, see https://docs.djangoproject.com/en/1.8/howto/custom-file-storage/.

Why do I need image-versions?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -52,4 +52,4 @@ Help is very much needed and appreciated. Test the |filebrowser| and submit feed
Who develops the |filebrowser|?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The |filebrowser| is developed and maintained by Patrick Kranzlmüller & Axel Swoboda of `vonautomatisch <http://www.vonautomatisch.at>`_.
The |filebrowser| is developed and maintained by Patrick Kranzlmüller & Axel Swoboda of `vonautomatisch <http://www.vonautomatisch.at>`_.
44 changes: 25 additions & 19 deletions docs/fieldswidgets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@
Fields & Widgets
================

The :ref:`filebrowsefield` is a custom model field which returns a :ref:`fileobject`. The widgets :ref:`fileinputwidget` and :ref:`clearablefileinputwidget` are used with the admin app in order to show an additional thumbnail for images.
The :ref:`filebrowsefield` is a custom model field which returns a :ref:`fileobject`.

.. _filebrowsefield:

FileBrowseField
---------------

.. py:class:: FileBrowseField(max_length[, site, directory, extensions, format, **options])
.. class:: FileBrowseField(max_length[, site, directory, extensions, format, **options])

A subclass of `CharField <https://docs.djangoproject.com/en/1.6/ref/models/fields/#charfield>`_, referencing a media file within.
A subclass of `CharField <https://docs.djangoproject.com/en/1.8/ref/models/fields/#charfield>`_, referencing a media file within.
Returns a :ref:`fileobject`.

:param site: A FileBrowser site (defaults to the main site), see :ref:`site`.
:param directory: Directory to browse when clicking the search icon.
:param extensions: List of allowed extensions, see :ref:`settingsextensionsformats`.
:param format: A key from SELECT_FORMATS in order to restrict the selection to specific filetypes, , see :ref:`settingsextensionsformats`.
:param format: A key from SELECT_FORMATS in order to restrict the selection to specific filetypes, see :ref:`settingsextensionsformats`.

For example:

.. code-block:: python
from filebrowser.fields import FileBrowseField
class BlogEntry(models.Model):
image = FileBrowseField("Image", max_length=200, directory="images/", extensions=[".jpg"], blank=True, null=True)
document = FileBrowseField("PDF", max_length=200, directory="documents/", extensions=[".pdf",".doc"], blank=True, null=True)
Expand All @@ -55,7 +55,7 @@ To show a thumbnail with the changelist, you can define a ModelAdmin method:
.. code-block:: python
from filebrowser.settings import ADMIN_THUMBNAIL
def image_thumbnail(self, obj):
if obj.image and obj.image.filetype == "Image":
return '<img src="%s" />' % obj.image.version_generate(ADMIN_THUMBNAIL).url
Expand All @@ -69,7 +69,7 @@ Using the FileBrowseField with TinyMCE

In order to replace the TinyMCE image/file manager with the FileBrowser, you have to use a `FileBrowser Callback <http://www.tinymce.com/wiki.php/Configuration:file_browser_callback>`_. There's an example TinyMCE configuration file in /static/js/ called TinyMCEAdmin.js. You can either copy the FileBrowserCallback to your own file or just use tinymce_setup.js (which comes with django-grappelli).

Just add these lines to your `ModelAdmin asset definitions <https://docs.djangoproject.com/en/1.6/ref/contrib/admin/#modeladmin-asset-definitions>`_:
Just add these lines to your `ModelAdmin asset definitions <https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#modeladmin-asset-definitions>`_:

.. code-block:: python
Expand All @@ -82,44 +82,50 @@ Just add these lines to your `ModelAdmin asset definitions <https://docs.djangop
FileInput
---------

Subclass of `FileInput <https://docs.djangoproject.com/en/1.6/ref/forms/widgets/#fileinput>`_ with an additional thumbnail:
Subclass of `FileInput <https://docs.djangoproject.com/en/1.8/ref/forms/widgets/#fileinput>`_ with an additional thumbnail:

.. code-block:: python
from filebrowser.widgets import FileInput
class BlogEntryOptions(admin.ModelAdmin):
formfield_overrides = {
models.ImageField: {'widget': FileInput},
}
.. warning::
Will be removed with 3.7.

.. _clearablefileinputwidget:

ClearableFileInput
------------------

Subclass of `ClearableFileInput <https://docs.djangoproject.com/en/1.6/ref/forms/widgets/#clearablefileinput>`_ with an additional thumbnail:
Subclass of `ClearableFileInput <https://docs.djangoproject.com/en/1.8/ref/forms/widgets/#clearablefileinput>`_ with an additional thumbnail:

.. code-block:: python
from filebrowser.widgets import ClearableFileInput
class BlogEntryOptions(admin.ModelAdmin):
formfield_overrides = {
models.ImageField: {'widget': ClearableFileInput},
}
.. warning::
Will be removed with 3.7.

Django FileField and the FileBrowser
------------------------------------

Return a :ref:`fileobject` from a `FileField <https://docs.djangoproject.com/en/1.6/ref/models/fields/#filefield>`_ or `ImageField <https://docs.djangoproject.com/en/1.6/ref/models/fields/#imagefield>`_ with:
Return a :ref:`fileobject` from a `FileField <https://docs.djangoproject.com/en/1.8/ref/models/fields/#filefield>`_ or `ImageField <https://docs.djangoproject.com/en/1.8/ref/models/fields/#imagefield>`_ with:

.. code-block:: python
from filebrowser.base import FileObject
image_upload = models.ImageField(u"Image (Upload)", max_length=250, upload_to=image_upload_path, blank=True, null=True)
def image(self):
if self.image_upload:
return FileObject(self.image_upload.path)
Expand All @@ -128,9 +134,9 @@ Return a :ref:`fileobject` from a `FileField <https://docs.djangoproject.com/en/
In order show a thumbnail with your changelist, you could use a ModelAdmin method:

.. code-block:: python
from filebrowser.base import FileObject
def image_thumbnail(self, obj):
if obj.image_upload:
image = FileObject(obj.image_upload.path)
Expand Down
4 changes: 2 additions & 2 deletions docs/filelisting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
FileListing
===========

.. py:class:: FileListing(path, filter_func=None, sorting_by=None, sorting_order=None)
.. class:: FileListing(path, filter_func=None, sorting_by=None, sorting_order=None)

Returns a list of FileObjects for a server path, see :ref:`fileobject`.

:param path: Relative path to a location within `site.storage.location`.
Expand Down
12 changes: 2 additions & 10 deletions docs/fileobject.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
FileObject
==========

.. py:class:: FileObject(path, site=None)
.. class:: FileObject(path, site=None)

An object representing a media file.

:param path: Relative path to a location within `site.storage.location`.
Expand Down Expand Up @@ -199,14 +199,6 @@ Folder attributes

The folder attributes make sense when the ``FileObject`` represents a directory (not a file).

.. attribute:: directory
.. deprecated:: 3.5.3
Use `path_relative_directory` instead.

.. attribute:: folder
.. deprecated:: 3.5.3
Use `dirname` instead.

.. attribute:: is_folder

``True``, if path is a folder::
Expand Down
14 changes: 11 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Django FileBrowser Documentation
**Media-Management with Grappelli**.

.. note::
|filebrowser| 3.5.8 requires Django 1.4/1.5/1.6 or 1.7 and |grappelli| 2.4/2.5 or 2.6.
|filebrowser| 3.6.1 requires Django 1.8 and |grappelli| 2.7.

Installation and Setup
----------------------
Expand Down Expand Up @@ -90,7 +90,15 @@ Use the `FileBrowser Google Group <http://groups.google.com/group/django-filebro
Versions and Compatibility
--------------------------

* FileBrowser 3.5.9 (Development Version, not yet released, see Branch Stable/3.5.x)
* FileBrowser 3.5.8 (September 7th, 2014): Compatible with Django 1.4/1.5/1.6/1.7
**FileBrowser is always developed against the latest stable Django release and is NOT tested with Djangos trunk.**

* FileBrowser 3.6.1 (September 9th, 2015): Compatible with Django 1.8
* FileBrowser 3.5.8 (September 7th, 2015): Compatible with Django 1.4/1.5/1.6/1.7

Current development branches:

* FileBrowser 3.6.2 (Development Version for Django >= 1.8, see Branch Stable/3.6.x)
* FileBrowser 3.5.9 (Development Version for Django <= 1.7, see Branch Stable/3.5.x)

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

0 comments on commit 95773ff

Please sign in to comment.