diff --git a/README b/README index 9780d40..603ab08 100644 --- a/README +++ b/README @@ -19,6 +19,15 @@ Example, in some urls.py: url_patterns = ('', url('^download/(?P[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`. ********** diff --git a/docs/index.txt b/docs/index.txt index 44efa00..e29873d 100644 --- a/docs/index.txt +++ b/docs/index.txt @@ -10,6 +10,7 @@ Contents demo install + views optimizations/index api/index about/index diff --git a/docs/views.txt b/docs/views.txt new file mode 100644 index 0000000..37429dd --- /dev/null +++ b/docs/views.txt @@ -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.