Introduced narrative overview of available download views in documentation.

This commit is contained in:
Benoît Bryon 2013-02-06 16:18:37 +01:00
parent 7876cfffc7
commit 5c91a53f40
3 changed files with 47 additions and 0 deletions

9
README
View file

@ -19,6 +19,15 @@ Example, in some urls.py:
url_patterns = ('',
url('^download/(?P<slug>[A-Za-z0-9_-]+)/$', download, name='download'),
)
Several views are provided to cover frequent use cases:
* ``PathDownloadView`` when you have an absolute filename.
* ``ObjectDownloadView`` when you have a model with a file field.
See :doc:`views` for details.
Then get increased performances with :doc:`optimizations/index`.
**********

View file

@ -10,6 +10,7 @@ Contents
demo
install
views
optimizations/index
api/index
about/index

37
docs/views.txt Normal file
View file

@ -0,0 +1,37 @@
##############
Download views
##############
This section contains narrative overview about class-based views provided by
django-downloadview.
****************
PathDownloadView
****************
The :py:class:`django_downloadview.views.PathDownloadView` class-based view
allows you to **serve files given an absolute path on local filesystem**.
Two main use cases:
* as a shortcut. This dead-simple view is straight to call, so you can use it
to simplify code in more complex views, provided you have an absolute path to
a local file.
* override. Extend :py:class:`django_downloadview.views.PathDownloadView` and
override :py:meth:`django_downloadview.views.PathDownloadView:get_path`.
******************
ObjectDownloadView
******************
The :py:class:`django_downloadview.views.ObjectDownloadView` class-based view
allows you to **serve files given a model with some file fields** such as
FileField or ImageField.
Use this view anywhere you could use Django's builtin ObjectDetailView.
Some options allow you to store file metadata (size, content-type, ...) in the
model, as deserialized fields.