Permalink
Browse files

Merge branch 'develop' of https://github.com/stefanfoulis/django-filer

…into develop
  • Loading branch information...
2 parents cd9c0fe + c523fa4 commit 8041b669aa42d6379cb593e94c6df0ef5a5ebdcc @chrisglass committed Aug 19, 2011
Showing with 9,371 additions and 2,173 deletions.
  1. +2 −0 .gitignore
  2. +3 −2 AUTHORS
  3. +1 −2 MANIFEST.in
  4. +14 −10 README.rst
  5. +0 −60 docs/getting_started.rst
  6. +5 −0 docs/index.rst
  7. +116 −0 docs/installation.rst
  8. +44 −0 docs/permissions.rst
  9. +3 −1 docs/running_tests.rst
  10. +24 −29 docs/server.rst
  11. +39 −71 docs/settings.rst
  12. +93 −0 docs/usage.rst
  13. +2 −2 filer/__init__.py
  14. +10 −10 filer/admin/__init__.py
  15. +40 −51 filer/admin/clipboardadmin.py
  16. +63 −56 filer/admin/fileadmin.py
  17. +823 −59 filer/admin/folderadmin.py
  18. +51 −0 filer/admin/forms.py
  19. +15 −10 filer/admin/imageadmin.py
  20. +21 −0 filer/admin/permissionadmin.py
  21. +4 −2 filer/admin/permissions.py
  22. +41 −4 filer/admin/tools.py
  23. +31 −20 filer/fields/file.py
  24. +44 −27 filer/fields/folder.py
  25. +6 −2 filer/fields/image.py
  26. +16 −8 filer/fields/multistorage_file.py
  27. BIN filer/locale/bg/LC_MESSAGES/django.mo
  28. +442 −95 filer/locale/bg/LC_MESSAGES/django.po
  29. BIN filer/locale/bs/LC_MESSAGES/django.mo
  30. +442 −95 filer/locale/bs/LC_MESSAGES/django.po
  31. BIN filer/locale/de/LC_MESSAGES/django.mo
  32. +442 −95 filer/locale/de/LC_MESSAGES/django.po
  33. BIN filer/locale/el/LC_MESSAGES/django.mo
  34. +442 −95 filer/locale/el/LC_MESSAGES/django.po
  35. BIN filer/locale/en/LC_MESSAGES/django.mo
  36. +442 −95 filer/locale/en/LC_MESSAGES/django.po
  37. BIN filer/locale/fr/LC_MESSAGES/django.mo
  38. +442 −95 filer/locale/fr/LC_MESSAGES/django.po
  39. BIN filer/locale/hu/LC_MESSAGES/django.mo
  40. +442 −95 filer/locale/hu/LC_MESSAGES/django.po
  41. BIN filer/locale/it/LC_MESSAGES/django.mo
  42. +564 −183 filer/locale/it/LC_MESSAGES/django.po
  43. BIN filer/locale/pl/LC_MESSAGES/django.mo
  44. +487 −103 filer/locale/pl/LC_MESSAGES/django.po
  45. BIN filer/locale/pt_BR/LC_MESSAGES/django.mo
  46. +821 −0 filer/locale/pt_BR/LC_MESSAGES/django.po
  47. BIN filer/locale/ro/LC_MESSAGES/django.mo
  48. +442 −95 filer/locale/ro/LC_MESSAGES/django.po
  49. BIN filer/locale/sr/LC_MESSAGES/django.mo
  50. +444 −95 filer/locale/sr/LC_MESSAGES/django.po
  51. +22 −24 filer/management/commands/import_files.py
  52. +129 −0 filer/migrations/0006_polymorphic__add_field_file_polymorphic_ctype.py
  53. +144 −0 filer/migrations/0007_polymorphic__content_type_data.py
  54. +128 −0 filer/migrations/0008_polymorphic__del_field_file__file_type_plugin_name.py
  55. +2 −2 filer/models/__init__.py
  56. +24 −12 filer/models/clipboardmodels.py
  57. +86 −58 filer/models/filemodels.py
  58. +93 −63 filer/models/foldermodels.py
  59. +48 −37 filer/models/imagemodels.py
  60. +6 −4 filer/models/mixins.py
  61. +12 −5 filer/models/tools.py
  62. +35 −10 filer/models/virtualitems.py
  63. +10 −7 filer/server/backends/base.py
  64. +4 −3 filer/server/backends/default.py
  65. +3 −0 filer/server/backends/nginx.py
  66. +8 −2 filer/server/backends/xsendfile.py
  67. +0 −1 filer/server/urls.py
  68. +4 −2 filer/server/views.py
  69. +54 −49 filer/settings.py
  70. +2 −1 filer/static/filer/css/admin_style.css
  71. BIN filer/static/filer/icons/video_16x16.png
  72. BIN filer/static/filer/icons/video_256x256.png
  73. BIN filer/static/filer/icons/video_32x32.png
  74. BIN filer/static/filer/icons/video_48x48.png
  75. +2 −1 filer/storage.py
  76. +16 −0 filer/templates/admin/filer/actions.html
  77. +5 −0 filer/templates/admin/filer/breadcrumbs.html
  78. +45 −0 filer/templates/admin/filer/delete_selected_files_confirmation.html
  79. +45 −0 filer/templates/admin/filer/folder/choose_copy_destination.html
  80. +41 −0 filer/templates/admin/filer/folder/choose_images_resize_options.html
  81. +44 −0 filer/templates/admin/filer/folder/choose_move_destination.html
  82. +28 −11 filer/templates/admin/filer/folder/directory_listing.html
  83. +15 −19 filer/templates/admin/filer/folder/directory_table.html
  84. +15 −6 filer/templates/admin/filer/folder/new_folder_form.html
  85. +1 −1 filer/templates/admin/filer/tools/clipboard/clipboard_item_rows.html
  86. 0 filer/templates/image_filer/folder.html
  87. +13 −0 filer/templatetags/filer_admin_tags.py
  88. +19 −9 filer/templatetags/filer_image_tags.py
  89. +0 −1 filer/templatetags/filer_tags.py
  90. +1 −0 filer/templatetags/filermedia.py
  91. +0 −1 filer/tests/__init__.py
  92. +189 −22 filer/tests/admin.py
  93. +1 −1 filer/tests/fields.py
  94. +4 −6 filer/tests/helpers.py
  95. +21 −27 filer/tests/models.py
  96. +24 −12 filer/tests/permissions.py
  97. +13 −13 filer/tests/tools.py
  98. +11 −11 filer/tests/utils.py
  99. +1 −1 filer/tests/utils/__init__.py
  100. +38 −34 filer/thumbnail_processors.py
  101. +32 −2 filer/utils/filer_easy_thumbnails.py
  102. +5 −4 filer/utils/files.py
  103. +1 −0 filer/utils/generate_filename.py
  104. +22 −11 filer/utils/loader.py
  105. +5 −3 filer/utils/pil_exif.py
  106. +3 −2 filer/utils/zip.py
  107. +70 −37 filer/views.py
  108. +106 −32 runtests.sh
  109. +2 −1 setup.py
  110. +222 −46 tests/bootstrap.py
  111. +6 −4 tests/buildout.cfg
  112. +13 −0 tests/clear.sh
  113. +7 −0 tests/django-124.cfg
  114. +7 −0 tests/django-125.cfg
  115. +7 −0 tests/django-13.cfg
  116. +48 −0 tests/django-all.cfg
  117. +19 −0 tests/django-trunk.cfg
  118. +17 −4 tests/project/settings.py
  119. +3 −0 tests/project/settings_django_12.py
  120. +3 −0 tests/project/settings_django_13.py
  121. +4 −4 tests/project/urls.py
View
@@ -16,13 +16,15 @@ build
*~
docs/_build
tests/.installed.cfg
+tests/.buildoutsig
tests/bin
tests/develop-eggs
tests/downloads
tests/eggs
tests/parts
tests/personal*.cfg
tests/project/personal*.py
+tests/reports/
distribute*
lib/
include/
View
@@ -1,6 +1,7 @@
-
* Divio GmbH (divio.ch) https://github.com/divio/
* Stefan Foulis <stefan.foulis@gmail.com> https://github.com/stefanfoulis
* Yann Malet <yann.malet@gmail.com> https://github.com/yml/
* Marko Mahnič https://github.com/mmahnic
- * Chris Glass https://github.com/chrisglass
+ * Chris Glass https://github.com/chrisglass
+
+For video file type we are using an icon by dreamxis, http://dreamxis.themex.net/, under Creative Commons Attribution license.
View
@@ -3,5 +3,4 @@ include LICENSE
include README.rst
include HISTORY
recursive-include filer/templates *
-recursive-include filer/media *
-
+recursive-include filer/static *
View
@@ -14,8 +14,9 @@ Dependencies
* `Django`_ 1.2 with django-staticfiles or `Django`_ 1.3
* django-mptt >= 0.2.1
-* `easy_thumbnails`_ requires the git version until the next release
-* `PIL`_ 1.1.7 (probably also works with older versions)
+* `easy_thumbnails`_ >= 1.0-alpha-17
+* `django-polymorphic`_ >= 0.2
+* `PIL`_ 1.1.7 (with JPEG and ZLIB support)
Installation
------------
@@ -31,10 +32,11 @@ Add ``"filer"`` to your project's ``INSTALLED_APPS`` setting and run ``syncdb``
Configuration
-------------
-django-filer can handle public and private files. Public files are your regular
-world readable files in ``MEDIA_ROOT``. Private files are a other case however.
-To be able to check permissions on the file downloads a special view is used and
-they are saved in a separate location (in a directory called `smedia` next to
+django-filer supports permissions on files. They can be enabled or disabled.
+Files with disabled permissions are your regular world readable files in
+``MEDIA_ROOT``. Files with permissions are a other case however. To be able to
+check permissions on the file downloads a special view is used and they are
+saved in a separate location (in a directory called `smedia` next to
``MEDIA_ROOT`` by default).
``filer.server.urls`` needs to be included in the root ``urls.py``::
@@ -43,9 +45,9 @@ they are saved in a separate location (in a directory called `smedia` next to
url(r'^', include('filer.server.urls')),
)
-By default private files are served directly by django. That is acceptable in
-a development environment, but very bad for performance in production. See
-the docs on how to serve files more efficiently.
+By default files with permissions are served directly by django. That is
+acceptable in a development environment, but very bad for performance in
+production. See the docs on how to serve files more efficiently.
For automatic subject location aware cropping of images replace
@@ -62,6 +64,8 @@ For automatic subject location aware cropping of images replace
)
.. _Django: http://djangoproject.com
+.. _django-polymorphic: https://github.com/bconstantin/django_polymorphic
.. _easy_thumbnails: https://github.com/SmileyChris/easy-thumbnails
.. _sorl.thumbnail: http://thumbnail.sorl.net/
-.. _PIL: http://www.pythonware.com/products/pil/
+.. _PIL: http://www.pythonware.com/products/pil/
+.. _Pillow: http://pypi.python.org/pypi/Pillow/
View
@@ -1,60 +0,0 @@
-Getting Started
-===============
-
-Dependencies
-------------
-
-* `Django`_ 1.2 with django-staticfiles or `Django`_ 1.3
-* `django-mptt`_ >= 0.2.1
-* `easy_thumbnails`_ requires the git version until the next release
-* `PIL`_ 1.1.7 (probably also works with older versions)
-
-Installation
-------------
-
-To get started using ``django-filer`` simply install it with
-``pip``::
-
- $ pip install django-filer
-
-Add ``"filer"`` to your project's ``INSTALLED_APPS`` setting and run ``syncdb``
-(or ``migrate`` if you're using South).
-
-Configuration
--------------
-
-django-filer can handle public and private files. Public files are your regular
-world readable files in ``MEDIA_ROOT``. Private files are a other case however.
-To be able to check permissions on the file downloads a special view is used and
-they are saved in a separate location (in a directory called `smedia` next to
-``MEDIA_ROOT`` by default).
-
-``filer.server.urls`` needs to be included in the root ``urls.py``::
-
- urlpatterns += patterns('',
- url(r'^', include('filer.server.urls')),
- )
-
-By default private files are served directly by django. That is acceptable in
-a development environment, but very bad for performance in production. See
-the docs on how to serve files more efficiently.
-
-
-For automatic subject location aware cropping of images replace
-``easy_thumbnails.processors.scale_and_crop`` with
-``filer.thumbnail_processors.scale_and_crop_with_subject_location`` in the
-``THUMBNAIL_PROCESSORS`` setting::
-
- THUMBNAIL_PROCESSORS = (
- 'easy_thumbnails.processors.colorspace',
- 'easy_thumbnails.processors.autocrop',
- #'easy_thumbnails.processors.scale_and_crop',
- 'filer.thumbnail_processors.scale_and_crop_with_subject_location',
- 'easy_thumbnails.processors.filters',
- )
-
-.. _Django: http://djangoproject.com
-.. _easy_thumbnails: https://github.com/SmileyChris/easy-thumbnails
-.. _sorl.thumbnail: http://thumbnail.sorl.net/
-.. _PIL: http://www.pythonware.com/products/pil/
-.. _django-mptt: https://github.com/django-mptt/django-mptt/
View
@@ -28,6 +28,8 @@ Getting help
* google group: http://groups.google.com/group/django-filer
* IRC: #django-filer on freenode.net
+.. _contributing:
+
Contributing
------------
@@ -43,6 +45,9 @@ Contents
:maxdepth: 1
getting_started
+ installation
+ usage
+ permissions
server
settings
running_tests
View
@@ -0,0 +1,116 @@
+.. _installation_and_configuration:
+
+Installation and Configuration
+==============================
+
+Getting the latest release
+--------------------------
+
+The easiest way to get ``django-filer`` is simply install it with `pip`_::
+
+ $ pip install django-filer
+
+If you are feeling adventurous you can get
+`the latest sourcecode from github <https://github.com/stefanfoulis/django-filer/>`_
+
+Dependencies
+------------
+
+* `Django`_ 1.2
+* `django-mptt`_ >= 0.2.1
+* `easy_thumbnails`_ >= 1.0-alpha-17
+* `django-polymorphic`_ >= 0.2
+* `PIL`_ 1.1.7 (with JPEG and ZLIB support) I recommend using `Pillow`_ instead.
+* `django-staticfiles`_ or ``django.contrib.staticfiles`` with `Django`_ 1.3 is
+ recommended
+
+Since the `PIL`_ package on `pypi`_ can be notoriously hard to install on some
+platforms it is not listed in the package dependencies in ``setup.py`` and won't
+be installed automatically. Please make sure you install `PIL`_ with JPEG and
+ZLIB support installed. I recommend the better packaged `Pillow`_ a better
+packaged fork of `PIL`_).
+
+Configuration
+-------------
+
+Add ``"filer"`` to your project's ``INSTALLED_APPS`` setting and run ``manage.py syncdb``
+(or ``manage.py migrate`` if you're using `South`_).
+
+Note that `easy_thumbnails`_ also has database tables and needs a ``syncdb`` or
+``migrate``.
+
+Static media
+............
+
+In order to operate properly, django-filer needs some js and css files. They
+are located in the ``static/filer`` directory in the ``filer`` package. If you are
+already using `django-staticfiles`_ or `django.contrib.staticfiles`_ you're
+already set and can skip the next paragraph.
+
+By default django-filer will look for those files at ``<MEDIA_URL>/filer/`` .
+Make sure that they are accessible at one of those locations.
+See the :ref:`FILER_STATICMEDIA_PREFIX` setting if you want to serve them from
+somewhere else.
+
+permissions on files
+....................
+
+django-filer supports permissions on files. They can be enabled or disabled.
+Files with disabled permissions are your regular world readable files in
+``MEDIA_ROOT``. Files with permissions are a other case however. To be able to
+check permissions on the file downloads a special view is used and they are
+saved in a separate location (in a directory called `smedia` next to
+``MEDIA_ROOT`` by default).
+
+``filer.server.urls`` needs to be included in the root ``urls.py``::
+
+ urlpatterns += patterns('',
+ url(r'^', include('filer.server.urls')),
+ )
+
+By default files with permissions are served directly by `django`_. That is
+acceptable in a development environment, but very bad for performance in
+production. See the docs on :ref:`how to serve files more efficiently
+<server>`.
+
+subject location aware cropping
+...............................
+
+It is possible to define the *important* part of an image (the
+*subject location*) in the admin interface for django-filer images. This is
+very useful when later resizing and cropping images with easy_thumbnails. The
+image can then be cropped autamatically in a way, that the important part of
+the image is always visible.
+
+To enable automatic subject location aware cropping of images replace
+``easy_thumbnails.processors.scale_and_crop`` with
+``filer.thumbnail_processors.scale_and_crop_with_subject_location`` in the
+``THUMBNAIL_PROCESSORS`` setting::
+
+ THUMBNAIL_PROCESSORS = (
+ 'easy_thumbnails.processors.colorspace',
+ 'easy_thumbnails.processors.autocrop',
+ #'easy_thumbnails.processors.scale_and_crop',
+ 'filer.thumbnail_processors.scale_and_crop_with_subject_location',
+ 'easy_thumbnails.processors.filters',
+ )
+
+To crop an image and respect the subject location::
+
+ {% load thumbnails %}
+ {% thumbnail obj.img 200x300 crop upscale subject_location=obj.img.subject_location %}
+
+
+
+.. _django-filer: https://github.com/stefanfoulis/django-filer/
+.. _django-staticfiles: http://pypi.python.org/pypi/django-staticfiles/
+.. _django.contrib.staticfiles: http://docs.djangoproject.com/en/1.3/howto/static-files/
+.. _Django: http://djangoproject.com
+.. _django-polymorphic: https://github.com/bconstantin/django_polymorphic
+.. _easy_thumbnails: https://github.com/SmileyChris/easy-thumbnails
+.. _sorl.thumbnail: http://thumbnail.sorl.net/
+.. _PIL: http://www.pythonware.com/products/pil/
+.. _django-mptt: https://github.com/django-mptt/django-mptt/
+.. _Pillow: http://pypi.python.org/pypi/Pillow/
+.. _pip: http://pypi.python.org/pypi/pip
+.. _South: http://south.aeracode.org/
View
@@ -0,0 +1,44 @@
+.. _permissions:
+
+Permissions
+===========
+
+.. NOTE:: For the impatient:
+
+ * set ``FILER_ENABLE_PERMISSIONS`` to ``True``
+ * include ``filer.server.urls`` in the root ``urls.py`` without a
+ prefix
+
+By default files can be uploaded and managed by all staff members based on the
+standard django model permissions.
+Since the files get uploaded to ``MEDIA_ROOT`` they can be can be downloaded by
+everyone.
+
+Optionally permission checking can be activated with the
+``FILER_ENABLE_PERMISSIONS`` setting. This allows setting access rights for
+editing files in the backend (with the `edit` permission) and downloading the
+files (with the `read` permission).
+For images the permissions also extend to all generated thumbnails.
+
+To be able to check permissions on the file downloads, a special view is used.
+The files are saved in a separate location outside of ``MEDIA_ROOT`` to prevent
+accidental serving. By default this is a directory called ``smedia`` that is
+located in the parent directory of ``MEDIA_ROOT``.
+The smedia directory must **NOT** be served by the webserver directly, because
+that would bypass the permission checks.
+
+The base directory and url for private files can be configured with the
+``FILER_PRIVATEMEDIA_STORAGE`` setting.
+
+To hook up the view ``filer.server.urls`` needs to be included in the root
+``urls.py``::
+
+ urlpatterns += patterns('',
+ url(r'^', include('filer.server.urls')),
+ )
+
+.. WARNING:: With the default settings the private files will be served by
+ django directly.
+ This is not what you'll want in production because performance is
+ not very good (especialy with large files).
+ See the :ref:`server` topic on how to improve this.
View
@@ -1,9 +1,11 @@
+.. _running tests:
+
Running tests
=============
There is a minimal project and buildout configuration to get the tests up and
running.
-In the source checkout run::
+In the source checkout switch to the ``tests`` directory and run::
python bootstrap.py
./bin/buildout
Oops, something went wrong.

0 comments on commit 8041b66

Please sign in to comment.