Skip to content

Commit

Permalink
Introduced narrative overview of available download views in document…
Browse files Browse the repository at this point in the history
…ation.
  • Loading branch information
benoitbryon committed Feb 6, 2013
1 parent 7876cff commit 5c91a53
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -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`.


**********
Expand Down
1 change: 1 addition & 0 deletions docs/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Contents

demo
install
views
optimizations/index
api/index
about/index
Expand Down
37 changes: 37 additions & 0 deletions docs/views.txt
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 5c91a53

Please sign in to comment.