| 1 |
################ |
| 2 |
HTTPDownloadView |
| 3 |
################ |
| 4 |
|
| 5 |
.. py:module:: django_downloadview.views.http |
| 6 |
|
| 7 |
:class:`HTTPDownloadView` **serves a file given an URL.**, i.e. it acts like |
| 8 |
a proxy. |
| 9 |
|
| 10 |
This view is particularly handy when: |
| 11 |
|
| 12 |
* the client does not have access to the file resource, while your Django |
| 13 |
server does. |
| 14 |
|
| 15 |
* the client does trust your server, your server trusts a third-party, you do |
| 16 |
not want to bother the client with the third-party. |
| 17 |
|
| 18 |
|
| 19 |
************** |
| 20 |
Simple example |
| 21 |
************** |
| 22 |
|
| 23 |
Setup a view to stream files given URL: |
| 24 |
|
| 25 |
.. literalinclude:: /../demo/demoproject/http/views.py |
| 26 |
:language: python |
| 27 |
|
| 28 |
|
| 29 |
************ |
| 30 |
Base options |
| 31 |
************ |
| 32 |
|
| 33 |
:class:`HTTPDownloadView` inherits from |
| 34 |
:class:`~django_downloadview.views.base.DownloadMixin`, which has various |
| 35 |
options such as :attr:`~django_downloadview.views.base.DownloadMixin.basename` |
| 36 |
or :attr:`~django_downloadview.views.base.DownloadMixin.attachment`. |
| 37 |
|
| 38 |
|
| 39 |
************* |
| 40 |
API reference |
| 41 |
************* |
| 42 |
|
| 43 |
.. autoclass:: HTTPDownloadView |
| 44 |
:members: |
| 45 |
:undoc-members: |
| 46 |
:show-inheritance: |
| 47 |
:member-order: bysource |