| 1 |
from django_downloadview import ObjectDownloadView |
| 2 |
|
| 3 |
from demoproject.object.models import Document |
| 4 |
|
| 5 |
#: Serve ``file`` attribute of ``Document`` model. |
| 6 |
default_file_view = ObjectDownloadView.as_view(model=Document) |
| 7 |
|
| 8 |
#: Serve ``another_file`` attribute of ``Document`` model. |
| 9 |
another_file_view = ObjectDownloadView.as_view( |
| 10 |
model=Document, file_field="another_file" |
| 11 |
) |
| 12 |
|
| 13 |
#: Serve ``file`` attribute of ``Document`` model, using client-side filename |
| 14 |
#: from model. |
| 15 |
deserialized_basename_view = ObjectDownloadView.as_view( |
| 16 |
model=Document, basename_field="basename" |
| 17 |
) |
| 18 |
|
| 19 |
#: Serve ``file`` attribute of ``Document`` model, inline (not as attachment). |
| 20 |
inline_file_view = ObjectDownloadView.as_view(model=Document, attachment=False) |