###################
StorageDownloadView
###################

.. py:module:: django_downloadview.views.storage

:class:`StorageDownloadView` **serves files given a storage and a path**.

Use this view when you manage files in a storage (which is a good practice),
unrelated to a model.


**************
Simple example
**************

Given a storage:

.. literalinclude:: /../demo/demoproject/storage/views.py
   :language: python
   :lines: 1, 4-5

Setup a view to stream files in storage:

.. literalinclude:: /../demo/demoproject/storage/views.py
   :language: python
   :lines: 3-6, 8-9

The view accepts a ``path`` argument you can setup either in ``as_view`` or
via URLconfs:

.. literalinclude:: /../demo/demoproject/storage/urls.py
   :language: python
   :lines: 1-6, 7-11, 17


************
Base options
************

:class:`StorageDownloadView` inherits from
:class:`~django_downloadview.views.base.DownloadMixin`, which has various
options such as :attr:`~django_downloadview.views.base.DownloadMixin.basename`
or :attr:`~django_downloadview.views.base.DownloadMixin.attachment`.


**************************
Computing path dynamically
**************************

Override the :meth:`StorageDownloadView.get_path` method to adapt path
resolution to your needs.

As an example, here is the same view as above, but the path is converted to
uppercase:

.. literalinclude:: /../demo/demoproject/storage/views.py
   :language: python
   :lines: 3-5, 11-20


*************
API reference
*************

.. autoclass:: StorageDownloadView
   :members:
   :undoc-members:
   :show-inheritance:
   :member-order: bysource
